All kinds of strange things happening (movie)

So I’ve been struggling with lighting for months now and actually haven’t been able to find solutions to any of the problems I’ve experienced so far - only workarounds. For instance, the problems I had with light shining through objects , I was only able to “solve” by putting objects on separate layers and using a light’s culling mask. Or the problem with faces of objects lighting up like a Christmas tree by turning of Directional Mode when baking lights.

But like I said, those are workarounds - not solutions.

But there are a few problems/glitches for which I can’t even find a workaround. And they are hard to reproduce. Because if I just change one small thing in my scene, the problems simply moves to another object.

I’ve made a small movie of a few of the problems I’m experiencing now. All only appear when looking at objects from certain positions and from certain angles. Sometimes just weird stuff happens (objects “glitch”), other times objects loose their lighting.

So yeah, anyone know what’s going on?

This looks like z-fighting to me. Make sure that your models don’t have any overlapping faces.

That was the first thing I checked. No overlapping objects, no overlapping faces.

Does it only happen in the built player, or also in editor? If you have the know-how, it might be worth taking a few RenderDoc (https://renderdoc.org/) captures to figure out what is happening here.

Either way, you’ll probably want to file a bug report for this - and make sure to include enough of your project to reproduce the issue if you do.

It happens only in the built player. In the editor, it runs without any problems.

I’m not sure I can reproduce it without actually including the entire project. This game consists of three scenes. The first two scenes run without any problems but they are much smaller. The third scene is quite big and that is where the problems are.

Big projects shouldn’t be an issue with regards to filing bug reports

I think in the video posted above, there are two different problems at work. Before the 0:30 time mark, I think the problem is caused by the shape of the object, but I’m currently investigating that, so I’ll come back to that later.

But from 0:31 onwards, it’s all one and the same problem for which I can’t find the cause. As you can see, objects simply loose their real-time lighting. Mind you, this happens throughout the scene. In fact, all static objects with a URP/Lit shader (as opposed to a Baked Lit shader) exhibit this behavior. But only when viewed from specific spots and certain angles. When the problem occurs, an object looses its real-time lighting and all that it’s left with is the baked part (from the lightmap). For some static objects I have set the size in the lightmap to 0, meaning they still contribute to GI, but do not get baked lighting. So when the problem occurs on these objects, they turn black (since they are only lit by the real-time part of a light and they don’t have lightmap data).

As I said, the problem only occurs from certain positions and certain angles. Sometimes that means that if you look straight an object, it looses it’s realtime lighting, and the lighting return if you look away, sometimes it’s the other way around.

All lights in the scene are mixed lights.

Just for giggles, I changed the Graphics API from OpenGLES3 to Vulkan and that got rid of all problems in the above video. So no more glitching and no more lighting problems. So problem solved you would think.

Well… Not so much. Now there’s a new problem with occlusion culling. Objects are glitching out of existence left and right now. Also, I have a feeling I get slightly lower FPS now than before.

This is what happens now. Look at the bottom of the stairs through the pillars. BTW, the pillars aren’t set as occluders (they are set as occludees), and it only happens when you look through “holes”.

These problems are the only things keeping me from finishing the game. In fact, the game is finished, I just need to get rid of bugs like these first before I can release it.

Does anyone have an explanation for the things happening in the above video?

I did some more testing and the problem is definitely caused by the baked occlusion data. If I clear the data and rebuild the game for the Quest, the problem is gone. But since the problem only occurs in the player and not in the editor, I must assume this is a bug in the player.