1
$\begingroup$

I ran into a problem while making a toon shader. I wanted to add specular made out of dots, where central spot of the specular will have larger dots, while the specular border will have tiny dots. In other words, I want the dot size to be dynamic, based on the size of the specular.

I couldn't produce it, but if anyone knows how to do it, I would be grateful for a method.

Bellow is the simplest setup of some dots and as you can see I tried using gradient texture and plugging it into a scale input of the voronoi texture. That of course did not work. I'm guessing the solution is in multiple math nodes after the voronoi texture.

I'm also adding an image which showcases my goal.

current state

desired state

$\endgroup$
2

1 Answer 1

1
$\begingroup$

This setup is far from perfect but can give you some direction : enter image description here

The trick is to use the "Shader To RGB" node to convert the lighting result into some usable value. This is an Eevee-only node.

For a greater variety of sizes, you can add more Voronoi textures and mix them in cascade, with greater then greater values in the top GreaterThan nodes.

I didn't manage to get a cleaner transition between the zones (some dots are cut in half, that doesn't look good).

$\endgroup$
2
  • $\begingroup$ It's not exactly what I was hoping for. This setup uses 3 voronoi textures each with it's own static scale value. I was hoping that the scale value could by dynamic. Thinking about it more, I'm not sure it can be done using voronoi texture. Maybe creating a gradient texture and duplicating it like in an array? $\endgroup$
    – Dalibor-P
    Commented Oct 22, 2020 at 19:50
  • $\begingroup$ I tried that first, by plugging the ShaderToRGB into the Scale of an unique Voronoi. That kinda works, but the dots won't be round anymore (because the same dot has multiple scales that vary smoothly) ; some where even severely distorted, giving spiral-like shapes. But I'm not a node wizard, maybe somebody will come with a more elegant solution ;) $\endgroup$
    – thibsert
    Commented Oct 22, 2020 at 20:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .