Achieving Light-Only Reveal Effect in Godot 4 for 3D Objects
Hey there, I’ve been working on an awesome visual effect in Godot Engine 4 where I want objects to only be visible in the parts that are illuminated by light sources. For my 2D scenes, I nailed it with the following shader code:
This has worked beautifully. However, when 3D scenes, I hit a wall. I’m quite new to shaders and particularly to 3D shader logic.
If anyone could provide guidance, share some sample code, or point me towards resources or tutorials that could help, I’d be immensely grateful. I’m eager to learn and get this technique under my belt! Best of luck, and I hope someone can chime in with some advice!
I gave it a shot and tweaked things a bit, and it looks pretty cool, but when I start spinning the view around, I’m still getting some weird jagged edges that just don’t look right.
This could help with transparency sorting on the same mesh; this is usually an issue when rotating around a transparent object that overlaps itself. It is a good idea to avoid “the transparent pipeline” where possible