Alpha splatting on terrain

Started by
1 comment, last by CosmCoder 21 years, 7 months ago
Question: I am having a problem when I blend the terrain layers. Since they are coplanar, I disable the depth test. This causes problems when a single geometry array folds and the transparent texture is overlayed on top of two distinct triangles. It is being written to the "far" triangle, but is actually being overlayed on top of the "near" triangle because the depth buffer test is disabled. Any thoughts on how to draw the blends in multiple passes (not in stacked texture units) but solve this peoblem? I certainly dont want to sort my terrain triangles since I am using an adaptive quadtree with texture paging, but I use the vertex buffers until I recalc the terrain vertices for sufficient view movement. Thanks!
David Yazelhttp://www.cosm-game.com
Advertisement
You could probably use glPolygonOffset or the dx equivalent for that. It alters the z-value by a slight amount when drawing so that geometry that would otherwise be identical doesn''t z-fight. Draw the base pass first, then the other two with a small offset...
if both passes use the saem geometry but differ in textures bound + blending enabled in one + not the other.
u shouldnt need to disable depthtest, use glDepthFunc( GL_LEQUAL ).
if something is majorly different in both passes eg clipping is enable in one pass u will need to use as zppz suggests polygon offset

http://uk.geocities.com/sloppyturds/gotterdammerung.html

This topic is closed to new replies.

Advertisement