Well, you would need different shader permutations. You could do this two ways:
1) have two different shaders, but they could re-use much of the same code. Your vertex shaders could call a common function that does much of the work. The VS for the static model could pass the "constant" values for BLENDWEIGHT0 and BLENDINDICES0 to this worker function.
2) keep your shader unchanged, and make a vertex buffer that is filled with the "constant" values for BLENDWEIGHT0 and BLENDINDICES0 (as big as necessary to support your biggest static model - or you may be able to mess with the instanceFrequency of the VertexBufferBinding to do something smarter), and supply this as a second vertex stream when drawing.
(1) is theoretically faster.
Show differencesHistory of post edits
#1phil_t
Posted 13 August 2012 - 01:43 PM
Well, you would need different shader permutations. You could do this two ways:
1) have two different shaders, but they could re-use much of the same code. Your vertex shaders could call a common function that does much of the work. The VS for the static model could pass the "constant" values for BLENDWEIGHT0 and BLENDINDICES0 to this worker function.
2) you could make a vertex buffer that is filled with the "constant" values for BLENDWEIGHT0 and BLENDINDICES0 (as big as necessary to support your biggest static model - or you may be able to mess with the instanceFrequency of the VertexBufferBinding to do something smarter), and supply this as a second vertex stream when drawing.
1) have two different shaders, but they could re-use much of the same code. Your vertex shaders could call a common function that does much of the work. The VS for the static model could pass the "constant" values for BLENDWEIGHT0 and BLENDINDICES0 to this worker function.
2) you could make a vertex buffer that is filled with the "constant" values for BLENDWEIGHT0 and BLENDINDICES0 (as big as necessary to support your biggest static model - or you may be able to mess with the instanceFrequency of the VertexBufferBinding to do something smarter), and supply this as a second vertex stream when drawing.