@mgulde wrote:
Dear all,
I am at a bit of a loss concerning how to pass data to a custom pixel shader when drawing sprites from a sprite batch.
I am drawing a 2D tile-based landscape and would like to additionally pass information on the height of the tile for later use. In 3D, I would use a custom vertex declaration and store the needed information in, e.g., an additional texture coordinate. However, I do not know how to access the vertex declaration when using the
SpriteBatch.Draw()
method.Here is the (default) VertexShaderOutput I am using right now:
struct VertexShaderOutput { float4 Position : SV_POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; };
Now, is there a way to use a custom vertex declaration instead?
Alternatively, I could use an additional
Texture2D
object to pass height information. then I would also need to pass the tile position so that I can relate the height information to the correct tile.So I am pretty much stuck at the moment, even though I am sure I am overlooking something fundamental. Any help (or alternative approach) would be highly appreciated.
Thanks!
Posts: 2
Participants: 1