Lighting individual voronoi cells as single points

hey folks,

been trying to figure this out for a while now, and i cant quite get it to work right.

I’ve got some 2D voronoi noise mapped to my model’s UVs, and I am trying to figure out a way to light each voronoi cell as if it were a single point (so if a shadow is cast onto an object, rather than casting an accurate shadow, it instead darkens the entire voronoi cells which it covers). Is this possible?

I’ve tried a number of different approaches but still not managed to get it working.

Thanks

There’s no easy way to do that… (at least a one-button solution).

You need:
To bake the illumination on the object first.
Then you can use the ‘position’ of the voronoi as the vector input of the baked texture.

so if i was doing an animation, i’d have to bake every frame?

If the light over the object changes during the animation, then yeah, you need to bake every frame.

hmm… would there be a way to do this via geometry nodes maybe?

If you manage to calculate light over surfaces inside GN, then it would be possible. (this almost implies building a renderer with GN :confused:)
I never tried to do that (and probably I’ll never will), but you can give it a shot.

It might even be possible to create a mapping vector that is tied to a ‘light’ source, but it wont be possible to control each ‘point’ from a voronoi noise individually.

Do you have more examples of what sort of effect you want to go for?

Quick idea:
In eevee there is the Shader to RGB node… with this and a less then node you might “detect” the darkened cells and “switch them” to you “complete shadow color”.

Another way might be in composite: using a crypto mate for the object and then again compare normal lightened versus shadow values ??

most my attempts so far have used a diffuse into a shader to rgb (a toon shader) and i’ve been trying to use it as a mask for shadows. problem is i need a way to retrieve color data directly from one part of a model (the center of each voronoi cell) and apply it to the rest of each voronoi cell, which doesnt seem to be possible.

That’s why some sort of baking is required!

At the render loop, some pixel needs to get the value of some other pixel, somewhere else in the screen… but it’s impossible to know if that other pixel was calculated or not!
That’s why ‘Baking’ is needed (, it forces a pre-step).

And there’s also the problem that you can’t convert UV coordinates to any other Texture space (object, world, camera)… But that would be a bit much for this thread.

i see… i thought i would be able to retrieve color data from a model “live” in a shader. i guess that doesnt really make sense in retrospect.
i will keep experimenting to see if i can find a workaround, as i would prefer not to bake every frame of animation !

thanks for your help folks