Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

texture: degrees of transparency

4: Adsense

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   

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


#2 JohnyCage   Members   

122
Like
0Likes
Like

Posted 19 January 2012 - 03:23 AM

attached better picture.

Attached Thumbnails

  • ukazka.jpg


#3 Evil Steve   Members   

2016
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
Senior Systems Programmer

Rockstar North


#4 JohnyCage   Members   

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.