November 18, 2017, 11:03:05 PM

Author Topic: Flickering Meshes at extreme distance.  (Read 214 times)

Offline MagosDomina

  • Jr. Member
  • **
  • Posts: 41
    • Aspiring game developer website.
Flickering Meshes at extreme distance.
« on: September 21, 2017, 01:29:00 AM »
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?
"Humanity has the stars in its future, and that future is too important to be lost under the burden of juvenile folly and ignorant superstition." -Isaac Asimov

http://www.magosdomina.com/
Central hub for my Game Design related activities.

Offline RonTek

  • Sr. Member
  • ****
  • Posts: 286
Re: Flickering Meshes at extreme distance.
« Reply #1 on: September 21, 2017, 03:35:58 AM »
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.

Offline Xaron

  • Full Member
  • ***
  • Posts: 226
Re: Flickering Meshes at extreme distance.
« Reply #2 on: September 21, 2017, 06:37:35 PM »
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.

Offline MagosDomina

  • Jr. Member
  • **
  • Posts: 41
    • Aspiring game developer website.
Re: Flickering Meshes at extreme distance.
« Reply #3 on: September 22, 2017, 03:52:13 AM »
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.
"Humanity has the stars in its future, and that future is too important to be lost under the burden of juvenile folly and ignorant superstition." -Isaac Asimov

http://www.magosdomina.com/
Central hub for my Game Design related activities.

Offline RemiD

  • Jr. Member
  • **
  • Posts: 2
Re: Flickering Meshes at extreme distance.
« Reply #4 on: November 13, 2017, 05:32:29 PM »
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))

Also, it may be caused by where is the origin ("root pivot") of the mesh, which is used for culling (depending on the camera field of view)

Offline col

  • Full Member
  • ***
  • Posts: 160
Re: Flickering Meshes at extreme distance.
« Reply #5 on: Today at 07:46:51 PM »
This link more than likely explains the real reason ;)
https://developer.nvidia.com/content/depth-precision-visualized