#### Archived

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

# How to render faster in D3D8

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

## 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 on other sites
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 on other sites

[edited by - PiXeLatiOn on December 6, 2002 9:18:39 AM]

##### Share on other sites
if ya render that much polygons in OGL, the performance is slow too?

.lick

##### 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 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 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 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).

1. 1
2. 2
frob
16
3. 3
4. 4
5. 5

• 15
• 13
• 14
• 75
• 22
• ### Forum Statistics

• Total Topics
632145
• Total Posts
3004345

×