Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


texture: degrees of transparency


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
3 replies to this topic

#1 JohnyCage   Members   -  Reputation: 122

Like
0Likes
Like

Posted 19 January 2012 - 03:11 AM

hi dudes.,

how can i start to use 256 degrees of transparency on my textured objects? I use following lines of code:

texture512 = Texture.FromFile(d, "1.png", 512, 512, 1, Usage.None, Format.A8R8G8B8, Pool.Managed, Filter.Triangle, Filter.Triangle, Color.FromArgb(255, 255,  0, 0).ToArgb());
.
.
device.SetRenderState(RenderState.AlphaBlendEnable, true);
device.SetRenderState(RenderState.SourceBlend, SlimDX.Direct3D9.Blend.SourceAlpha);

device.SetRenderState(RenderState.AlphaTestEnable, true);
device.SetRenderState(RenderState.AlphaRef, 0x01);
device.SetRenderState(RenderState.AlphaFunc, SlimDX.Direct3D9.Compare.Always);

Attached picture can describe better my problem. Black places are not mixed by yellow background.

Attached Thumbnails

  • ukazka.jpg


Sponsor:

#2 JohnyCage   Members   -  Reputation: 122

Like
0Likes
Like

Posted 19 January 2012 - 03:23 AM

attached better picture.

Attached Thumbnails

  • ukazka.jpg


#3 Evil Steve   Members   -  Reputation: 1983

Like
2Likes
Like

Posted 19 January 2012 - 08:00 AM

You need to set the destination blend type too. Something like:
device.SetRenderState(RenderState.DestBlend, SlimDX.Direct3D9.Blend.InvSourceAlpha);
I'm not sure what the SlimDX state names are, but you want to set the destination blend to inverse source alpha.

Steve Macpherson
Systems Programmer

Rockstar North


#4 JohnyCage   Members   -  Reputation: 122

Like
0Likes
Like

Posted 19 January 2012 - 08:52 AM

You need to set the destination blend type too. Something like:

device.SetRenderState(RenderState.DestBlend, SlimDX.Direct3D9.Blend.InvSourceAlpha);
I'm not sure what the SlimDX state names are, but you want to set the destination blend to inverse source alpha.


y, its right answer, thanks.




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