Jump to content
  • Advertisement
Sign in to follow this  
Timptation

Point sprite color with vertex shader issue

This topic is 3316 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'm currently changing code from the fixed function methods to use a vertex shader. I have a simple firework particle system with verts that use a position and a DWORD color. I randomized the color and things worked fine, but now with the shader, I'm only getting a white and a blue color. The shader is quite simple: VS_OUTPUT output = (VS_OUTPUT)0; input.position.w = 1.0f; output.position = mul(input.position, ViewProjMatrix); output.color = input.color; return output; What might the problem be? Should I create a pixel shader and pass the color through it as well? Does a render state need to be changed? I've tried disabling/enabling textures to no effect. Any thoughts would be welcome.

Share this post


Link to post
Share on other sites
Advertisement
If you don't have a pixel shader bound to the pipeline, then whatever you output through the color semantic should get interpolated and rasterized just like in the fixed function setup, IIRC.

Do you have a per-vertex color attribute in your input vertex data? Try setting it to all 1's in the vertex shader to see if you can get a texture color to be applied to the sprite.

Share this post


Link to post
Share on other sites
It would seem my problem was that i was outputting the color as an int, rather than as a vector. Why would this be though? When using fixed function FVFs, my color was a DWORD, which worked fine, so I simply tried to pass that through my vertex shader. Something about using a shader made it expect a four float setup instead, even though I specified it as an int?

Share this post


Link to post
Share on other sites
Yes, that's the standard way that a color is output - each of the four components range from [0.0:1.0], and the fourth component is the alpha channel.

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.

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

Sign me up!