Jump to content
  • Advertisement

Archived

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

Dragun

How to render faster in D3D8

This topic is 5651 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I have loaded up a height field of 128x128 via a .raw file and currently rendering it by chunking it in two calls
    
 App.pDirect3DDevice->SetStreamSource(0,pTerrainVertexBuffer,sizeof(D3DVERTEX));
 App.pDirect3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 16129);
 App.pDirect3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 48387,16129); 
  
I got 16129 by doing 127x127 = 16129. This works fine and dandy but it's too slow... I know I should only transform and draw the triangles that are visable but how can this be accomplished with D3D? Any information would help. [edited by - Ðragun on December 6, 2002 8:36:03 AM]

Share this post


Link to post
Share on other sites
Advertisement
you should get some infos about frustum culling. You simply get the bounding box of your geometry (the minimal and maximal X/Y/Z-Value) and then you check if this bounding box is visible. There''s an good method at dx4vb.da.ru, but it''s VB code. And there''s also an good method at gametutorials.com, but it''s OGL (but you could easily convert the code to D3D)

Share this post


Link to post
Share on other sites
quote:
Original post by CrazedGenius
You probably want to use indexed lists - fewer vertices.



Don''t know if that''s the case here, but I''ve been wondering this for a while: Aren''t indexed lists, vertex strips etcetera pretty much useless when you''re using normals (which, if I''m not mistaken, would be whenever you''d want to use lighting)? Perhaps not with rounded objects, but when rendering a cube, don''t you still need to use three different vertices for the same corner of the cube, in order to make the normals perpendicular to the cube face? As a result, you''d still need 36 vertices for a simple cube. Or am I mistaken?

Share this post


Link to post
Share on other sites
No. Quads always share 2 verts, since they consists of two coplanar tri''s. So a nonindexed cube would use 6 verts for each side (quad), totalling 36 like you said, whereas an indexed cube would only need 4 for each side, totalling 24. That saves 12 * 32 - 24 * 2 = 336 bytes using your average FVF vertex (pos, n, tex2).

Share this post


Link to post
Share on other sites
And MAKE THE PATCHES SMALLER. Most people dont use more than 65x65 vertices per rendered patch :-) I use (now - after 65x65) 33x33. This allows way more granular culling.


Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)

Share this post


Link to post
Share on other sites
I personnaly render a terrain of an hudge amount of face (256*256*2= 131072 faces).

to it I divided this object in 16 * 16 objets of 16 * 16 * 2 faces each: and I render 9 of them each frame so I render 512 * 9 faces per frames.

the speed id very good even on a lousy video card like mine (40 fps on a rage 128 in 1024 * 768).



Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!