Archive 17/01/2023.

Geometry: IndexBuffer and VertexBuffer

slapin

While working on character cutomization and processing Geometry class I wonder why
can we have multiple VertexBuffer per geometry but just single IndexBuffer.

How do IndexBuffer relate to multiple VertexBuffers?

Eugene

IB <-> VSs relation is the same as before. The only exception is that data of single vertex is fetched from several VBs instead of one.

slapin

How can I distinguish which data go from which VB?

slapin

Another question while we’re here - we have SEM_BLENDINDICES data which is 4 bytes
Is it just bone number? Does 0 have special meaning?

Eugene

How can I distinguish which data go from which VB?

VertexElement description must have a kind of VB index or stream index.

Is it just bone number? Does 0 have special meaning?

Yes. No.

slapin

can I expect that vertexBuffers[x].vertexElements[y] will always reference VB x, or is it shared upon
all VBs?

Eugene

May you please re-phrase this part?

slapin

each VertexBuffer have array of VertexElemant.
Can I rely that each array will contain elements belonging to corresponding VB or
these arrays are shared upon all VBs?

slapin

This is what I currently do -

I set current model’s IndexBuffer so that it will not contain vertices with blendindices not in range.
Am I on right way or I’m doing something wrong?

Eugene

Huh, I’ve forgotten about this implementation detail…
Yes, you can rely. VertexElement array describe elements stored in corresponding VB.

Elements from multiple VBs are “merged” into single set of elements before passing into Vertex Shader.

slapin

@Eugene could you please help me again,
As I understad, Geometries with lod > 0 all share VB with Geometry with lod = 0, am I right?
But each Geometry with lod = 0 can have its own VB. Is it correct?

Eugene

LODs don’t have to interfer with each other, so every LOD could (but don’t have to) have its own set of buffers.

slapin

Well, when I tried generating LODs, when I added extra buffers for LODs it did not work for some reason…