Re: Which method is better?
From: Peter Venis (petervenis_at_zonnet.nl)
Date: 06/27/04
- Next message: n!: "Re: Which method is better?"
- Previous message: Gokhan: "directx collision detection"
- In reply to: Eyal Teler: "Re: Which method is better?"
- Next in thread: n!: "Re: Which method is better?"
- Reply: n!: "Re: Which method is better?"
- Reply: Eyal Teler: "Re: Which method is better?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 27 Jun 2004 10:47:39 +0200
No, you described the situation incorrectly.
The scene I have is one big mesh exported from 3DsMax. The entire mesh is in
one vertex buffer, and there's only one index buffer.
Becuase I want to render only cubical chunks of the mesh (this becuase of
frustum culling) I need to devide the mesh in many parts. If I only devide
the index buffer in seperate index buffers (method one) then the indices
will reference to vertices all throughout the vertex buffer, not like you
said in 'chunks of vertices that can be referenced seperately'.
You must keep in mind that the vertices are shared vertices. If for example
I would devide the vertex buffer into seperate buffers then the total number
of vertices will increase with about 10% because many vertices need to be
duplicated.
The reason I'm hoping to keep them in one buffer is because it will take
less memory, and I won't need to go through the trouble of splitting them
into multiple buffers, much less work. But will one vertex buffer be just as
fast as seperate buffers considering the fact that I need to set a wide
range of vertices with each DrawIndexedPrimitive() call?
Peter
"Eyal Teler" <et@nospam-et3d.com> schreef in bericht
news:%235gvCO9WEHA.1144@TK2MSFTNGP10.phx.gbl...
> Okay, I'll repeat the previous question in more detail:
>
> In solution 2, say you have 4 vertex buffers, each with 100 vertices
> and corresponding index buffers. If you put all 4 buffers into one
> vertex buffer of 400 vertices, your 4 rendering calls will reference
> each chunk of vertices separately. They won't be "anywhere in the
> vertex buffer".
>
> So what's the problem with this solution?
>
> Eyal
>
> Peter Venis wrote:
> > Look at the DrawIndexedPrimitive() description in MSDN, there you will
read
> > this:
> >
> > The MinIndex and NumVertices parameters specify the range of vertex
indices
> > used for each IDirect3DDevice9::DrawIndexedPrimitive call. These are
used to
> > optimize vertex processing of indexed primitives by processing a
sequential
> > range of vertices prior to indexing into these vertices. It is invalid
for
> > any indices used during this call to reference any vertices outside of
this
> > range
> >
> > I need to call only a limited amount of indices per call, but those
indices
> > can reference to vertices anywhere in the vertex buffer, that's why some
> > calls the NumVertices parameter is almost as big as the vertex buffer
> > itself.
> >
> > Peter
> >
> >
> >
> >
> > "Eyal Teler" <et@nospam-et3d.com> schreef in bericht
> > news:uP$JO%235WEHA.2408@tk2msftngp13.phx.gbl...
> >
> >>It's not clear to me why you have to select a wide range of vertices
> >>in method 1. If you take what you have in method 2 and put it into one
> >>buffer, then you will have a limited range for each call.
> >>
> >>Eyal
> >>
> >>Peter Venis wrote:
> >>
> >>>Hi,
> >>>
> >>>I'm rendering a large group of triangles that only have a position and
> >>>normal and the same render states. Because of frustum culling, I need
to
> >>>render those vertices in different chunks by calling them through
> >
> > indices.
> >
> >>>All vertices are currently in one big vertex buffer. Which of the two
> >>>methods is better / faster?:
> >>>
> >>>METHOD ONE:
> >>>
> >>>Keep all vertices in one big buffer and only create seperate index
> >
> > buffers.
> >
> >>>This way we only need to set vertex buffer to stream 0 once and then
set
> >
> > the
> >
> >>>index buffers for each seperate call. However, each time I call
> >>>DrawIndexedPrimitive() I need to select a wide range of vertices,
> >
> > sometimes
> >
> >>>almost the entire vertex buffer.
> >>>
> >>>METHOD TWO:
> >>>
> >>>Split both the vertices and the indices into seperate buffers. This way
> >
> > we
> >
> >>>must set both the vertex and index buffer at each call but only need to
> >>>select a small range of vertices when calling DrawIndexedPrimitive()
> >>>
> >>>Peter
> >>>
> >>>
> >
> >
> >
- Next message: n!: "Re: Which method is better?"
- Previous message: Gokhan: "directx collision detection"
- In reply to: Eyal Teler: "Re: Which method is better?"
- Next in thread: n!: "Re: Which method is better?"
- Reply: n!: "Re: Which method is better?"
- Reply: Eyal Teler: "Re: Which method is better?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|