Jump to content
  • Advertisement
Sign in to follow this  
Alex F

DX10 sprite and pixel shader

This topic is 2758 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_pSprite->DrawSpritesImmediate(&m_SpriteDefinition, 1, 0, 0);

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
Sign in to follow this  

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!