Lighting in Godot not matching Blender, weird reflections

Godot Version

Godot 4.2.1

Question

Hey folks! I’ve made a model in Blender and imported it into Godot. Before you ask, I’m aware of the bug where lighting units aren’t the same and the lights are way way too bright in Godot, and I’ve already worked around that. This one is trickier, I think. The main issue is that first of all lights don’t appear to be blocked by geometry (including collision geometry), and then even besides that the reflections are weird and inconsistent between faces. Here’s a picture of Godot:

And here’s roughly that same area in blender:

So it kinda looks to me like a flipped normal situation, but in blender I can turn on face orientation, turn on visible normals, and turn on matcap and they all look right to me:


So everything looks right in blender.

What’s especially weird to me is that the lights in this scene are upstairs and in another room. There’s, like, 3 to 5 faces in between this wall and the light it appears to be showing. And what’s more, the light is actually through the wall, above but behind it in the way the camera is looking. So it doesn’t appear to be reflecting the light at all, but rather almost lensing it? If I turn on x-ray mode in Blender so I can see through the geometry it looks like this:

So I’d expect to be seeing the reflection of lights sort of behind and to the left of my camera, where I’ve drawn the dashed line, but there are no lights there. The lights it’s reacting to are the ones you can see behind the wall in the distance. If anything, I think it’s actually the dark faces on the wall and floor that are the accurate ones. There are currently no lights to illuminate those surfaces, but I think some of the faces appear to have decided differently?

Anyway, it doesn’t seem like Godot has as-rich tooling for debugging a mesh. Does Godot store some kind of per-face cache somewhere of which lights illuminate which face, which may be cleared somehow? I’ve turned the visibility of the lights on and off, and the environment, and while they react when the lights go out, they look the same as now when the lights come back on. I’m not currently using any kind of Global Illumination node or anything, just straight meshes, triplanar derived collision shapes, and omni lights.

Does anyone have any thoughts here?

Maybe you didn’t setup your environement properly: there are reflection probe nodes, VoxelGI nodes. Could also be a setting in the World Environement.

I remeber having this issue before and i believe everytime you make an indoor, you need a volume that tells Godot to calculate more precisely lights, but I’m not sure…

Hm, just checked, look at the reflection probe and set it to Interiot, it should maybe fix it…

Hah! Found it! You have to enable shadow on all of your lights. It’s maybe the isssue yoou’re encountering!

Hmm. It looks like I must have turned shadows on at some point, because they appear to be on.

I’ve even turned them all off and back on just now to make sure, and not a lot changed. I could see a small shadow appear upstairs in the doorway of the room with the lights, but nothing downstairs where this photo screenshot was taken.

I also tried adding a reflection probe, but it doesn’t seem to have made any change at all to the scene.

While testing it I did get really close to the wall, though, and yeah, you can see all 5 of the lights, basically as plain as day, “through” the wall. So I’m not sure what’s going on here, but it doesn’t seem right…

Okay, I fixed it, and it was my fault.

Since Godot didn’t have a great way of debugging the faces, I wanted to be absolutely sure that it wasn’t a Blender issue, so I exported from Blender manually (just that one part) so I could maybe try re-importing back into Blender to see what was up.

Well, the export from Blender did not go well… Things got really weird. So at this point it seemed like my mesh topology was bad enough that it was actually just wrong. Blender was able to render it without issue, but couldn’t export it to another system in the same way, I guess.

So, to fix it I just did a cleanup pass where I fixed the mesh mostly manually. There were a lot of sins in there, like edges that crossed but did not have a vertex at their intersection, and then faces on those edges that intersected each other but didn’t technically “touch” as far as the mesh was concerned. And almost definitely some things I failed to extrude once, leading to duplicated vertices and edges sitting on top of each other.

One thing I did to help do the very first pass, which would make sure edges intersected and vertices weren’t sitting on top of their duplicates was to, in Edit Mode, turn on the “Auto Merge Vertices” and the “Split Edges & Faces” options. Then I selected-all and grabbed, moved by 0, and then hit enter. This at the very least made sure the duplicates were gone and that edges didn’t go through each other any more. There was still some weird faces I had to rebuild, but all in all it wasn’t too bad.

And then, when that was all done, I went back to Godot and everything was perfect! So in the end, the real enemy was just my lack of skillz :stuck_out_tongue: