How do I obtain the color tint from a sprite batch from within the HLSL shader? I’m working with xna.
Also, what is the theory behind this? I would think that the tint color would just change the actual texture color before passing it to HLSL, but that does not seem to be the case.
You can look at the source code for the default
SpriteBatchshader here. Look atSpriteEffect.fxfor details.Specifically the tint colour is passed in
COLOR0to the vertex shader, which is then passed directly to the pixel shader. In the pixel shader it gets multiplied by the texture sample for that pixel.Modifying the texture data directly would be tremendously slow.