Trying to make Toon Shader Material on UE4

Yup, should be able to just feed in the initial brightness of the pixel (which above you multiply by # of bands, take ceil of, then divide by # of bands) as a UV coordinate for your ramping texture. Probably a good idea to clamp it between 0 and 1 first to prevent any strange artefacts.

This is actually what the shader you link two does; the brightness of the pixel gets used as the first coordinate, and some other parameter termed ‘detail shading type’ gets used for the second coordinate. The ‘Cel Texture’ is then used as a map to select some color for given illumination and ‘detail shading type’ (which i guess is some function of distance from the camera).

If ‘Cel Texture’ was smooth, you’d get smooth shading. If it were banded, you’d get a cel shaded effect, which is what you are after.

Hope that helps. Anything unclear?