Jump to content
  • Advertisement
Sign in to follow this  

DX10 sprite and pixel shader

This topic is 2247 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using ID3DX10Sprite to draw 2D image on the screen. 3D scene contains only one textured sprite placed over the whole window area. Render method looks like this:

m_pDevice->ClearRenderTargetView(...);
m_pSprite->Begin(D3DX10_SPRITE_SORT_TEXTURE);
m_pSprite->DrawSpritesImmediate(&m_SpriteDefinition, 1, 0, 0);
m_pSprite->End();

Now I want to make some transformations with the sprite texture in a shader. Currently the program doesn't work with shader. How it is possible to add pixel shader to the program with this structure?

Inside the shader, I need to set all colors equal to red, and multiply pixel values by some coefficient. Something like this:


float4 TexturePixelShader(PixelInputType input) : SV_Target
{
float4 textureColor;
textureColor = shaderTexture.Sample(SampleType, input.tex);

textureColor.x = textureColor.x * coefficient;
textureColor.y = textureColor.x;
textureColor.z = textureColor.x;

return textureColor;
}

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!