Flickering Meshes at extreme distance.

Started by MagosDomina, September 21, 2017, 01:29:00

Previous topic - Next topic

MagosDomina

Usually such an anomaly is caused by two faces of a mesh occupying either the same location or if they are in very close proximity to each other. I have it now occasionally happening when a large amount of meshes are drawn on screen. Its not any of my meshes themselves as I was very careful to trim out an unneeded faces that would never be shown to the player.

What I am observing is the lighting and occasionally mesh itself flickering, as if it cannot decide if its in the foreground or not.

Can a large draw distance affect the lighting? This seems a bit strange to me since I only use a single world Light. What about scaling? Is the 3d engine working too hard to calculate accurate lighting? I wonder if implementing a culling system would solve this? I know Blitz3d only draws what is seen and a basic LOD system but something is still not working right here. Is there an easy way to change the color of the void? Which by default is black.

I may be answering my own question here but I always enjoy insight provided by others. My theory is that my simulation is having trouble with calculating the extreme distances, as I have not implemented any sort of Homecoming solution yet. Meaning the world needs to move around the player, with everything re-positioning itself correctly since the player character technically never leaves location 0,0,0.

To the best of my knowledge almost every (if not all) flight simulators are coded in such a way. Am I on the right track here or totally off?

RonTek

You can try reducing your camera near range say 0.001 and/or scale your scene and models down. A decent far range also would be better afaik.

Xaron

That's a pretty common problem. Graphic cards, especially not the latest ones have a z buffer with floating point precision which means that you simply have rounding issues which can lead to that unwanted behavior.

MagosDomina

#3
I figured out the cause after noticing the flickering happened much less often without Vsync enabled. The ground layer was competing with the CameraCLSColor. When I got rid of the ground layer I could fly as high and far as I wanted with no meshes glitching. Setting the ground layer Entity Order to 1 to match the skybox allowed me to have the ground back without the anomaly as described above.

To clarify I wasn't talking about the usual artifacts you get within the Z buffer. The issue that was occurring was the meshes appeared to be flickering in and out of existence at far distances.

RemiD

#4
Yes, i have seen a similar issue, and sometimes you have to use entityorder for far way meshes like a skybox, terrainbox, horizonfog, sun, moon...

If you want to have a far view range, a good approach is to render the scene in several passes, this way the camerarange "ratio" stays small enough (for example : one render with a camerarange of 100->100 000 (ratio=1000) and then one render with a camera range of 0.1->100 (ratio=1000))


col

https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."