Jump to content

  • Log In with Google      Sign In   
  • Create Account


Diffuse Colors Alpha Channel Ignored


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 DJTN   Members   -  Reputation: 199

Like
0Likes
Like

Posted 09 April 2012 - 01:25 PM

Is it possible to use the Alpha from my Vertices Diffuse Color and the alpha in the Texture? Currently I have a particle system that changes the alpha values of the vertex diffuse color over time and the texture has a transparent background. Is it possible to use both? Currently the alpha in the diffuse color has no affect on the final color. In my shader I want to use both. Is this possible?

Sponsor:

#2 gfxgangsta   Members   -  Reputation: 477

Like
0Likes
Like

Posted 09 April 2012 - 01:33 PM

You should be able to multiply the texture alpha with the vertex color's alpha to get the final color's alpha. Can you post the shader code?

#3 DJTN   Members   -  Reputation: 199

Like
0Likes
Like

Posted 09 April 2012 - 01:52 PM

I don't think the issue is in the shader:

float4 diffuse = tex2D(diffuseSampler, IN.texcoord) * IN.color;

return diffuse;


The "IN.color" is my vertex color. The color is recognized but not the alpha.

I tried the following to test:


float4 diffuse = tex2D(diffuseSampler, IN.texcoord);

diffuse.w = IN.color.w;

return diffuse;


Still, the alpha is not recognized. I checked the vertex data before it's getting sent over and the diffuse color's alpha is set correctly.

#4 gfxgangsta   Members   -  Reputation: 477

Like
0Likes
Like

Posted 09 April 2012 - 02:26 PM

How are you changing the vertex alpha?
Are you using vertex buffers? If so, are you locking the vertex buffer, modifying the value and unlocking the vertex buffer?
Or are you using vertex arrays?

#5 gfxgangsta   Members   -  Reputation: 477

Like
0Likes
Like

Posted 09 April 2012 - 02:34 PM

Also, have you enabled alpha blending?

#6 DJTN   Members   -  Reputation: 199

Like
0Likes
Like

Posted 09 April 2012 - 02:47 PM

Thanks for your help gfx, I found my problem. I have a method that removes a particle after it's faded out or it expires. The particles faded out so quickly they died before the fade could be seen.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS