D3D and ROAM

Started by
3 comments, last by Snowman 23 years, 6 months ago
Hey guys. I''ve been looking into ROAM as my LOD algo for my terrain. It looks like it will work out great, but I have one question in regards to rendering it with D3D... At run time, ROAM makes a big binary triangle tree of all of the triangles in the scene. Then, at render it loops through getting the (x, y, z) coordinate for each vertex and renders as a triangle list. My question is, what''s the best way to do this with D3D? examle code: RecurrsiveFunction( coordinates of triangle ) { // Get the three verts of the triangle. // Render them? // Pass on info for the children triangles (ones split from us) } Now, as you can see that will result in a whole lot of DrawPrimitive() calls which will be incredibly slow my intuition tells me =). So, what to do? With OpenGL you can pass verts one at a time (glVertex3f() or something like that). Any ideas? Thanks in advance!! -Snowman
Advertisement
Can you build a vertexbuffer while ROAM''ing?

Then you can call just the one function to render the whole buffer, right?
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
I don''t know a whole lot about vertex buffers, but the way I understand it, Vertex buffers are filled using Lock() and Unlock() right? Well, I''ve also heard that it''s slow to do that over and over which is what I''d have to do in order to add all of my triangles...

Any other ideas?

Thanks!

-Snowman
Yeah, one idea is to call the recursive function and just
do a single lock before you enter, then unlock and a call
to drawprimtive when your finished.

Of course you will have to take into account vertex limits
on the buffers etc.

i.e.

VB->Lock()
RecursiveFunction()
{
// Get 3 verts for triangle
// Check space left in VB
// if so add them
// if not DrawPrimitive VB with current set of triangles
// and switch to another VB to start filling

// Recursive function to next tri''s
}
VB->UnLock()

Draw Remaining tri''s.

Obviously this is a basic outline of what needs to be
done.

--
Code..reboot..code..reboot..sigh!
MrF.--Code..reboot..code..reboot..sigh!
This sounds like a good idea, I''ll try it out and compare speeds to see if it''s faster than calling a bunch of drawprimitives(). Thanks!

-Snowman

This topic is closed to new replies.

Advertisement