Setting a General Alpha Value

Started by
4 comments, last by PSioNiC 22 years, 9 months ago
Is there a way to make every vertex that passes through the vertex pipeline have a certain alpha value, without using a vertex shader ? My final goal is to have every mesh on the screen being 50% transparent Is there a render state or some function that I can call to do this or am i going to have to iterate through the vertex buffer and set each vertex''s alpha value to the same thing ( ??? )
"This is stupid. I can't believe this! Ok, this time, there really IS a bug in the compiler."... 20 mins pass ..."I'M AN IDIOT!!!"
Advertisement
Could you multitexture, setting your render states to use the texture, a 1x1 texture with your alpha value, and ignore the vertex colors?

I don''t know if this is the answer, just an off the cuff suggestion...
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
All that for a stupid little task like this?
There has got to be an easier way
"This is stupid. I can't believe this! Ok, this time, there really IS a bug in the compiler."... 20 mins pass ..."I'M AN IDIOT!!!"
G''day!

Try setting your ALPHAARG1 to D3DTA_TFACTOR with ALPHAOP as SELECTARG1 (or if you already have some transparency, set OP to MODULATE and set ARG2 to whatever you want).

Then SetRenderState(D3DRS_TEXTUREFACTOR,D3DCOLOR_ARGB(alpha,0,0,0)

That should work.


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena
You can also set per-vertex alpha in the diffuse component of the vertex's lighting. You then need to set D3DRS_ALPHAOP to D3DTOP_MODULATE, D3DRS_ALPHAARG1 to D3DTA_TEXTURE and D3DRS_ALPHAARG2 to D3DTA_DIFFUSE if you have a texturea alpha, otherwise set D3DRS_ALPHAOP to D3DTOP_SELECTARG1 and D3DRS_ALPHAARG1 to D3DTA_DIFFUSE.


Edited by - furby100 on June 29, 2001 9:27:24 AM
Or you can just use a material...

Z.
______________"Evil is Loud"

This topic is closed to new replies.

Advertisement