Terrain rendering bug on large view distances
by Jari · in Torque Game Engine · 07/04/2006 (8:29 pm) · 15 replies
#2
07/07/2006 (6:41 pm)
So is there anything we can do? I notices anisottropy setting in the game options but setting this to zero did not help.
#3
Putting a grid texture onto the terrain is going to give very odd results due to sampling issues.
07/08/2006 (12:16 am)
This is in TGE? Interesting.Putting a grid texture onto the terrain is going to give very odd results due to sampling issues.
#4
Basically when the bitmap gets too far away or offscreen, the engine will sample/mipmap the texture so it blends better with the enviorment. A grid texture is such a fine detail that it will get blurred all over and your result might be what you shown above.
07/08/2006 (1:34 am)
@Jari:Basically when the bitmap gets too far away or offscreen, the engine will sample/mipmap the texture so it blends better with the enviorment. A grid texture is such a fine detail that it will get blurred all over and your result might be what you shown above.
#5
Can any one confirm this? All you have to do is to load the flat.mis and fly away from the ground.
07/08/2006 (9:12 am)
Hmm, that is understandable but like I said this is from tutorial.base and I would like to add that I used a debug exe built from the HEAD source. So i believe it's a bug in HEAD. Can any one confirm this? All you have to do is to load the flat.mis and fly away from the ground.
#6
Can any one confirm this? All you have to do is to load the flat.mis and fly away from the ground.
07/08/2006 (7:33 pm)
Hmm, that is understandable but like I said this is from tutorial.base and I would like to add that I used a debug exe built from the HEAD source. So i believe it's a bug in HEAD. Can any one confirm this? All you have to do is to load the flat.mis and fly away from the ground.
#7
If you find a way to fix it, I'm all ears, but it's pretty tough to do so w/o burning tons of texture memory or processing power. :)
07/09/2006 (3:52 pm)
It's not a bug, it's an artifact of how the textures are blended & rendered. You get similar artifacts using a normal texture on normal geometry, with a 1px checkerboard. Go research "Nyquist limit" for the theory behind this limitation.If you find a way to fix it, I'm all ears, but it's pretty tough to do so w/o burning tons of texture memory or processing power. :)
#8
Here is the other thread: http://www.garagegames.com/mg/forums/result.thread.php?qt=45608
07/09/2006 (8:10 pm)
Riight, thanks for clearing that out Ben. Hmm it looks pretty bad in minimap when the textures are missing, is there really no way prevent that from happening using some hack or something? :)Here is the other thread: http://www.garagegames.com/mg/forums/result.thread.php?qt=45608
#9
Here is the other thread: http://www.garagegames.com/mg/forums/result.thread.php?qt=45608
07/10/2006 (2:09 am)
Riight, thanks for clearing that out Ben. Hmm it looks pretty bad in minimap when the textures are missing, is there really no way prevent that from happening using some hack or something? :)Here is the other thread: http://www.garagegames.com/mg/forums/result.thread.php?qt=45608
#10
Have you tried using another texture map for testing... maybe a much larger grid pattern say, one box per tile...
OR... (not sure if this would work even) In your texture, you could try surrounding the smaller boxes by a larger box (perhsps just coloring the edges of the whole tile texture) you could use a color that is in high contrast to the other... that way the mipmapping might let you get away with still seeing the large box on far zoom.
07/10/2006 (5:16 am)
The blocky purple corner is there because of the mip map blending away the detail in your grid texture. Have you tried using another texture map for testing... maybe a much larger grid pattern say, one box per tile...
OR... (not sure if this would work even) In your texture, you could try surrounding the smaller boxes by a larger box (perhsps just coloring the edges of the whole tile texture) you could use a color that is in high contrast to the other... that way the mipmapping might let you get away with still seeing the large box on far zoom.
#11
But test with a different texture, you WILL have weird results with a checkerboard. Even using just the hardware (as the terrain does some special texture caching/blending) will give strange results. BTW - none of your image links work for me. All I can see is the tiny thumbnail in your first post here.
07/10/2006 (7:32 am)
The minimap renders slightly differently (orthographic projection, special terrain rendering path).But test with a different texture, you WILL have weird results with a checkerboard. Even using just the hardware (as the terrain does some special texture caching/blending) will give strange results. BTW - none of your image links work for me. All I can see is the tiny thumbnail in your first post here.
#12
07/10/2006 (8:09 am)
You could remove this 'feature' but that'll make your textures seem very pixelated at long range, so there's really no option.
#13

I got the same results as the OP using the defualt blue grid texture, but I imported a more detailed texture (wood) to see if this was an issue specific to the grid pattern. As shown in the image, it does not seem to be exclusive to the grid texture. Not only that but if you try to zoom out any further than shown above the engine will crash every time. There is also mip-banding occuring even in close up shots like the following example. This leads me to believe that the issue might be caused by the way the engine is handling the mip-mapping.

In an attempt to avoid this issue, I manually set my video card's (GF6800) anisotropic filtering to 16x (default on application-controlled). After doing that the mip-banding shown in the above image was reduced conciderably, however it had no effect on the texture artifacts occuring with high draw distance. Changing the anti-aliasing had no effect what-so-ever.


I would have to assume this bug is related to how the engine is sampling textures to generate the mip-maps. I suspect that a game would rarely allow such high draw distance, or that static meshes in the scene would mask the problem. Even so, I think its safe to say this is a bug. Whether or not this is an issue with the Torque engine specifically or with the 3d apis its using is another question entirely. But its definately there. Try it for yourself.
There is also a great article on Gamasutra which explains the Nyquist Limit and how mip-mapping works: Run-Time MIP-Map Filtering. Definately worth a read.
08/10/2006 (12:32 pm)
I can confirm that I am also experiencing the same issue as the OP on a clean install of the TGE 1.4 SDK. I used the same values for draw distance (2500) and fog distance (2300). You wont notice these artifacts if the fog distance is close, it only happens if panned out far. You can see an example of this in the image below:
I got the same results as the OP using the defualt blue grid texture, but I imported a more detailed texture (wood) to see if this was an issue specific to the grid pattern. As shown in the image, it does not seem to be exclusive to the grid texture. Not only that but if you try to zoom out any further than shown above the engine will crash every time. There is also mip-banding occuring even in close up shots like the following example. This leads me to believe that the issue might be caused by the way the engine is handling the mip-mapping.

In an attempt to avoid this issue, I manually set my video card's (GF6800) anisotropic filtering to 16x (default on application-controlled). After doing that the mip-banding shown in the above image was reduced conciderably, however it had no effect on the texture artifacts occuring with high draw distance. Changing the anti-aliasing had no effect what-so-ever.


I would have to assume this bug is related to how the engine is sampling textures to generate the mip-maps. I suspect that a game would rarely allow such high draw distance, or that static meshes in the scene would mask the problem. Even so, I think its safe to say this is a bug. Whether or not this is an issue with the Torque engine specifically or with the 3d apis its using is another question entirely. But its definately there. Try it for yourself.
There is also a great article on Gamasutra which explains the Nyquist Limit and how mip-mapping works: Run-Time MIP-Map Filtering. Definately worth a read.
#14
For the terrain mip issue - that's particularly odd as it would imply a bug in the terrain texture blending code. For reference, the way the terrain texture cache works is that it combines at runtime various source textures into tiles that are then applied to the terrain geometry. So what you might be seeing could be a bug in the blending logic, or in the texture cache (maybe it's miscalculating something and clamping the texture incorrectly at high view distances?) rather than a mipping issue.
If you need high view distances, you might want to look at TSE and specifically the Atlas terrain technology there.
08/10/2006 (1:14 pm)
Have you tried making sure (or forcing) trilinear filtering on? That may resolve the artifact in the first image. In most situations it's not a major issue, as usually textures don't have 1px lines on them.For the terrain mip issue - that's particularly odd as it would imply a bug in the terrain texture blending code. For reference, the way the terrain texture cache works is that it combines at runtime various source textures into tiles that are then applied to the terrain geometry. So what you might be seeing could be a bug in the blending logic, or in the texture cache (maybe it's miscalculating something and clamping the texture incorrectly at high view distances?) rather than a mipping issue.
If you need high view distances, you might want to look at TSE and specifically the Atlas terrain technology there.
#15
08/10/2006 (6:59 pm)
I did try forcing trilinear filtering and I didnt notice a difference. This issue doesnt really concern me, though. It would be a rare case to be zoomed that far out and may just be limited to this flat plane example. I was just verifying the original poster's experience. I am planning on porting over to TSE soon, so that is probably the best option anyway.
Torque 3D Owner iHugMedia