Forums

Full Version: display artifacts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
look at circled tree in this picture:
[Image: sky+fence.jpg]
the sky behind the tree gets sort of blended in (it happens only if the fence is in between the tree and the camera). if i advance the camera just a little bit so it's in front of the fence the tree gets rendered normally:
[Image: sky-fence.jpg]
this is not the only place where i saw this (the vertical grass blades at montreal suffer from the same problem) and probably other places as well.

both objects (the fence and the grass blades) have mipmap disabled. maybe there is some kind of strange interaction between objects without mipmap and blended objects (sky?)

--alex--
When rendering objects VDrift has two modes: alpha testing and alpha blending. Alpha testing mode is always on unless the object is set as transparent in the list.txt file. Alpha testing will draw parts of objects that have transparency < 50% as fully transparent and > 50% as fully opaque. Alpha blending does partial transparency based on the exact alpha value. The problem with alpha blending is that now the visual results are dependent on draw order, and so when transparent objects overlap you get artifacts.

For objects like trees, fences, and grass, you should probably turn off the transparent mode so that alpha testing is used instead... just use the transparent setting for things that tint the underlying object somehow like glass or tire marks. Using alpha testing also makes shadowing work better, because you'll actually see the outline of the object in the shadow instead of just a big rectangle. I realize the edges of objects don't look as good when you turn off the transparency, but if you turn on 4X anti-aliasing they look good again. :-)

Alternatively I could try to figure out a way to fix the artifacts, but it will decrease performance quite a bit because all of the transparent polygons would have to be re-sorted by depth each frame.
joevenzon Wrote:For objects like trees, fences, and grass, you should probably turn off the transparent mode so that alpha testing is used instead... just use the transparent setting for things that tint the underlying object somehow like glass or tire marks. Using alpha testing also makes shadowing work better, because you'll actually see the outline of the object in the shadow instead of just a big rectangle. I realize the edges of objects don't look as good when you turn off the transparency, but if you turn on 4X anti-aliasing they look good again. :-)
none of those textures are set as transparent but they might be double-sided (the grass is, not sure about the trees). the mipmap is disabled for the fence. anyway, i just noticed this happens without the fence, having two trees in front of each other also causes the sky to show up.

which parameter one is the transparent mode?

--alex--
Let me dig it up....

Code:
#format for each object:
#0. model filename (no spaces allowed)
#1. texture filename (no spaces allowed)
#2. mipmap texture (1 for true, 0 for false)
#3. disable lighting (1 for true, 0 for false)
#4. is this a skybox? (1 for true, 0 for false)
#5. is this object a transparent blended texture? (1 for true, 0 for false)
#6. bump wavelength
#7. bump amplitude
#8. driveable (1 for true, 0 for false) -> deprecated, use collide-able flag
#9. collide-able (1 for true, 0 for false)
#10. friction coefficient for non-treaded tires
#11. friction coefficient for treaded tires
#12. rolling resistance coefficient (http://en.wikipedia.org/wiki/Rolling_friction)
#13. rolling drag

So make sure parameter 5 is set to 0 for the trees, fence, grass, etc.
Hmm... thinking about it a little more...

Do you have anti-aliasing on or off? Shaders on or off?

Also, which track? Let me see if I can reproduce.
joevenzon Wrote:Hmm... thinking about it a little more...

Do you have anti-aliasing on or off? Shaders on or off?

Also, which track? Let me see if I can reproduce.

none of those textures are set to be transparent. i play with shaders off, antialiasing set to 2x. i've seen this happening at montreal and ring2007 (at montreal it was the vertical glass blades, at ring2007 it was the fence, but i also saw it with two trees). none of those textures are set to be transparent blended textures. something else is wrong there.

--alex--
joevenzon Wrote:Also, which track? Let me see if I can reproduce.

experimented with this a little bit more. i can pretty much see it on every track. the simplest way is to look through a mesh fence.

--alex--
Alright, I see this now too. It looks like it goes away with anti-aliasing turned off. I think I know what's going on. With anti-aliasing enabled there's a method to make the edges of alpha tested objects a little smoother that I recently started using, and from what I've read it's supposed to do it without causing these artifacts, so either I'm doing something wrong or the technique isn't as robust as I thought.
Alright, this should be fixed with R2316 and data R325. Note that you get even sharper anti-aliasing on the alpha tested objects if you turn on shaders... but it should look good with shaders off and anti-aliasing on, too.
joevenzon Wrote:Alright, this should be fixed with R2316 and data R325. Note that you get even sharper anti-aliasing on the alpha tested objects if you turn on shaders... but it should look good with shaders off and anti-aliasing on, too.
looks much better thanks. i don't turn on the shaders because the performance goes way down (although it looks much better, i admit).

--alex--