So, I’m working on a closed room with indoor lighting (an omnilight for now). The light isn’t supposed to be visible outside the room. But I want the ceiling to be invisible in the camera, despite blocking the light. Any ideas how to do this?
Thanks in advance!
If you are using some kind of Physically Based Rendering shader, this is impossible, obviously, but since Godot doesn’t have those by default (I think?) it’s really easy to just make “one way” walls/ceilings etc; just use backface culling. A face with its normal pointing away from the camera will not be rendered, but since the light is inside, it will be blocked, because the light sees the face with the normal pointing towards it.
There are other possible interpretations of your question, but I chose to answer the most likely one. If this doesn’t answer your question, provide more details on what you have made and what you want to make.
Thanks for the reply. I think we’re on the same track.
Conceptually I understand backface culling, but I’m unsure how to do this in Godot. As context, for testing purposes I’m using CSG boxes with standard 3d materials. Now, do I have to create a working model in e.g. Blender to try this out, or can it be done with any object in Godot?
Sorry for the noob questions.
Yeah, then the problem is you’re using a CSG box, which is always going to be a shape with outwards normals and no holes.
You can use the default Godot plane, or in blender you can make any shape you like and enable backface culling on the viewport to preview how it will hide.
If you enable Normals on the object display properties you’ll see tiny lines pointing away from the center of each face toward the side it’s visible from.
There are also tools to flip normals on faces and auto-calculate them if needed.
If you have doubts consult the blender manual, normals are a standard thing in 3D models and you should get comfy with the concept.
That’s very helpful. TYSM!
You can just make every wall (and the ceiling) a separate CSG box instead of fitting an entire room into one box. In my prototype, I have this kind of setup and I make the ceiling transparent ($Ceiling.transparency = 1.0) in certain conditions. The shadow from the global DirectionalLight3D that the ceiling casts always stays there with no special trickery required.
But do note that CSG stuff is not a good thing to have on your final game, because it is procedural geometry that’s rather slow to use in realtime.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.