Hiya,
I'm trying to build a renderer for my small game project, but I'm having a bit of a problem with vertex declarations - I was hoping someone could help?
For each mesh in a scene, I need to render it several times each frame using different HLSL shaders. Most shaders take different vertex input structures though, which I think means I need to set different vertex declarations. But how can I do this if I can only store a mesh in memory in a single vertex format?
Could vertex streams be used for this - one for positions, one for normals, etc? I could then just bind the ones needed by a particular shader when necessary. Nvidia seems to recommend using as few as possible though, so I'm wondering if this would be mis-using them?
Otherwise, I could just keep a fully bloated copy of each mesh, set a huge vertex declaration for a single stream, and the shaders can just use the parts they want. This seems a bit messy though...
Can anyone comment, or recommend the best solution?
Thanks very much for any help!
I'm trying to build a renderer for my small game project, but I'm having a bit of a problem with vertex declarations - I was hoping someone could help?
For each mesh in a scene, I need to render it several times each frame using different HLSL shaders. Most shaders take different vertex input structures though, which I think means I need to set different vertex declarations. But how can I do this if I can only store a mesh in memory in a single vertex format?
Could vertex streams be used for this - one for positions, one for normals, etc? I could then just bind the ones needed by a particular shader when necessary. Nvidia seems to recommend using as few as possible though, so I'm wondering if this would be mis-using them?
Otherwise, I could just keep a fully bloated copy of each mesh, set a huge vertex declaration for a single stream, and the shaders can just use the parts they want. This seems a bit messy though...
Can anyone comment, or recommend the best solution?
Thanks very much for any help!
The post was edited 1 time, last by beebs1 ().