Archived

This topic is now archived and is closed to further replies.

asd_de

Terrain Multipass Rendering (DX)

Recommended Posts

Hello, I use multipass rendering for my terrain. Each Terrain Type gets a separate pass, and basically I just set the vertices which are not visible/not of the current terrain type to alpha=0, so that I automatically get smooth terrain transitions and the likes. Now I have following problem: when I do have a transition, as the z value of the vertices of both terrains is equal, I get a partially shine-through effect (looks very bad). So now, I just copied my terrain VertexBuffer 7 times (the number of terrain types) and just changed the z value according to terrain number (I''m using D3DTLVERTEX, so that isn''t a problem). But, of course, this raises the memory requirements, and as I get more terrain types / more tile states (each state (visible/in range/selected/etc.) gives an additional VB so that they don''t need to be changed each frame), the memory requirements go up way too fast for me - is there any way around this? If I just turn off Z-Buffering, I would get problems with my water plane and the overlapping of objects. Thanks, asd_de

Share this post


Link to post
Share on other sites
No one an idea? Here's a screenshot: sometimes nothing is drawn at all (1), sometime everything is correct (2), and sometimes, there are transparent stripes (3).




Edited by - asd_de on June 21, 2001 8:06:07 AM

Share this post


Link to post
Share on other sites
You could try setting your z-buffer test to less than or equal, instead of just less than. Though this won''t always work (if there''s any precision errors it still won''t look right) but often it''ll be ok.

Also, I don''t think geocities lets you link images from other sites (like gd.net)


War Worlds - A 3D Real-Time Strategy game in development.

Share this post


Link to post
Share on other sites
quote:
Original post by Dean Harding


Also, I don''t think geocities lets you link images from other sites (like gd.net)


War Worlds - A 3D Real-Time Strategy game in development.


Yeah, it only works if I open the picture separately first (copy and paste URL), and then right-click and go on show picture. Do you know any free web host allowing that?

I will try that z-buffer option.

Thx,
asd_de

Share this post


Link to post
Share on other sites
No, it did not help :-( same problem.
I found out it only happens when the base tile is drawn splitted vertically (you know, each quad can be splitted to triangles in 2 ways), and the transition above it (2nd pass) was splitted horizontally in order to look better. Culling is off so the not-drawn-at-all triangles can't be due to this.

Edited by - asd_de on June 22, 2001 8:24:17 AM

Share this post


Link to post
Share on other sites
I have had this same problem before.
Although it was with OpenGL, that shouldn''t make any difference. What you have to do is change your frustum near and far planes : you render close objects with near / far planes set at, say, 0.2f and 100.0f, and distant objects with planes set at 99.9f and 10000.0f, clearing the z-buffer before you change the frustum.
What this does is that the z-buffer becomes more accurate and so gets rid of "stripes" (keep depth testing at less and equal though). The drawback of this method is that you have to do depth sorting and render some of your stuff twice. Unfortunately, I don''t think there is any other way of bypassing this problem.

Good luck

Mustard

Share this post


Link to post
Share on other sites
quote:
Original post by ColonelMustard
I have had this same problem before.
Although it was with OpenGL, that shouldn''t make any difference. What you have to do is change your frustum near and far planes : you render close objects with near / far planes set at, say, 0.2f and 100.0f, and distant objects with planes set at 99.9f and 10000.0f, clearing the z-buffer before you change the frustum.
What this does is that the z-buffer becomes more accurate and so gets rid of "stripes" (keep depth testing at less and equal though). The drawback of this method is that you have to do depth sorting and render some of your stuff twice. Unfortunately, I don''t think there is any other way of bypassing this problem.

Good luck

Mustard

I suppose near/far clipping planes can only be used when you let D3D do the transformations? I pass over D3DTLVERT''ices to it, and supply the exact same dvSZ value to them (in fact, it is the same D3DTLVERTEX object).

Share this post


Link to post
Share on other sites