Light textures in Eevee?

Image from Gyazo

Is there a way to do it with default tools? In this example, I used fake spotlight generated by nodes to project a “decal”, but this workflow is inconvenient as I have to copy and paste nodes in every material affected by the “light”. If it can be done by default in Eevee, please tell which version of Blender, since I’m still on 3.6

This is off the top of my head, but I think you might be able to come up with a solution using information from the Texture Coordinate node. Maybe something involving picking out a specific point in Generated/Normal/Object/Whatever data and then generating a gradient out from it using a map range node?

1 Like

That works, but it is the same workflow I’ve tried so far. Get Texture Coordinates - Object input, plus maybe other data such as direction of the empty object, then calculate sort of decal mapping or distance field based on those variables. The drawback that even if I put this system into custom node group, I’ll have to reconnect the output to each material in the scene. Tedious. Thats why I asked if there is easier way in newer Blender versions

fake spotlight.blend (4.5 MB)
The sort of setup I used. As you can see, there is another problem: cannot composite it properly with real shadow (and fake shadows cannot be computed within the material nodes because of technical reasons)

I’m a little confused what you’re going for. Are you just trying to do a toon shader with dynamic lighting from the scene, or do you want this lighting baked onto the model, like a toy with its highlighting painted on?

In this case, put a “toon” effect (banding) on a specific light. Since I may need to have different toon settings (such as # of shading levels and shading threshold) in all of my materials, but want this light to affect all of them the same way, if it makes sense

On the second thought, maybe this light being “real” light will undermine my plan. Since then it will be affected by toon settings through Shader to RGB on per material basis

Something I’ve been playing around with is setting up a basic shader, running it through Shader to RGB, but then using separate RGB with the result. Then I’ll use (for example) a pure B light to act as my base lighting, then a pure R light for my highlights, etc. Then I use the R G and B output to drive mix shaders or something, and I can control my base colors different from my highlights. The three colors almost act as Light Groups, in a weird way. Maybe what you’re looking for is something like that?

I’m away from my computer so I don’t have any screenshots or anything on-hand, but I hope I didn’t explain that too confusingly, haha.

2 Likes

This is actually genius, in terms of performance optimization. No need to have multiple Shader to RGB nodes for different purposes, just have 1 and tweak the base shader’s RGB color input

NVM, got what you actually meant

Image from Gyazo Something like that

There’s not a direct way to do this in Eevee.

Usually, custom materials would be the best bet.

However, it would also be possible to do this with scenes and compositing, assuming your materials are simple enough:

  1. Main scene doesn’t contain the stepped light.

  2. Second scene is a “fullbright” scene: same geometry, 1.0 white world, no other lights.

  3. Third scene (which could be a viewlayer of scene 1 rather than its own scene) contains the stepped light but no other lights (including no world lighting.) Rather than using the geometry directly, instance it using geometry nodes from your other geometry so that you can override the material in GN (probably, you want a 1.0 white diffuse, but maybe you want some specular in there.)

In compositing, quantize the third scene however you want to step your lighting, then add the third scene to the first scene on the basis of the value of the second scene. So your output color is (s2 * s3 + s1).

1 Like

Thanks; haven’t thought about compositing. Need to learn about it more. That’s unfortunate that there isn’t default support for light textures, but I guess looking for workarounds is part of the fun


Here’s a slightly more graceful version of this, showing one possible way to mix-and-match the shaders. Right here I’m using Mix Colors with Add just to sort of emulate the regular shader, but you can use these RGB channels as masks for pretty much any shaders you want.


Here’s an example. The right globule is just a regular diffuse shader getting hit by Red, Green and Blue lights, the left is getting that same lighting, but with the node setup I posted.

Something else you should consider instead of a color ramp with a bunch of different knocks in it is to use a Map Range node set to Linear Stepped, then plug THAT into a regular color ramp. This makes it much easier to set how many steps you want to see in your lighting.

If I got this link to work right, here’s an example of a similar setup using RGB lights to reveal three different shaders.