Jump to content
  • Advertisement
Sign in to follow this  
CastorX

d3d how to set transparency

This topic is 3085 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

Hi! I want to draw transparent triangles on the screen in Direct3D11, but it does not work. (simple triangle scene tutorial) SHader code: extern Texture2D baseTexture; extern SamplerState samLinear; float4x4 matWVP; struct VSOUT { float4 hPos : SV_POSITION; float4 tmp : TEXCOORD0; float2 tex : TEXCOORD1; }; VSOUT VSMain( float4 Pos : POSITION , float4 Col : COLOR, float2 Tex : TEXCOORD0) { VSOUT Out; Out.hPos = mul(float4(Pos.x,Pos.y,Pos.z,1.0),matWVP); Out.tmp = Col; Out.tex = Tex; return Out; } float4 PSMain( VSOUT In ) : SV_Target { float4 O = baseTexture.Sample(samLinear,In.tex)*In.tmp; O.w = 0.1f; return O; } back buffer type is DXGI_FORMAT_R8G8B8A8_UNORM, I'm using dx9 feature level with hardware acceleration. Can anyone help? What do I need to do to make my triangles transparent?

Share this post


Link to post
Share on other sites
Advertisement

float4 PSMain( VSOUT In ) : SV_Target
{
float3 O = baseTexture.Sample(samLinear,In.tex)*In.tmp;

return float4(O, 0.1f);
}





If you set alpha to 0.1f you wont see the object lol

Share this post


Link to post
Share on other sites
Quote:
Original post by CastorX
I want to draw transparent triangles on the screen in Direct3D11, but it does not work. (simple triangle scene tutorial)


Hi!
mhh... you are a bit generic with this "does not work".

I don't use yet DirectX11, just searching on documentation I found something related to D3D11_BLEND_DESC. Did you use it? How?

Share this post


Link to post
Share on other sites
The blend desc this is missing. that is the problem I think. Thank you! (I'm new in d3d11; in d3d9 things were different.)

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!