Sign in to follow this  
Trounce

Opacity in .X Files? Nothing partially transparent.

Recommended Posts

Trounce    122
Hello, I'm using Deep Exploration to export 3DS files to .X. My problem is that my program code (and the SDK example) ignore my material opacity. Where is the opacity stored in the .X file (or the Alpha -- whatever it's called), how can I test for it, and what do I need to add to my render function to display that material as partially opaque? Loading my newly exported .X file back in to Deep Exploration shows partially opaque materials correctly. So it must be a feature lacking in my (and the SDK example's) mesh loading routine? Thank you!

Share this post


Link to post
Share on other sites
Jim Adams    440
Either in the alpha channel of your texture maps or in the Material data object (it's the 4th # in the diffuse color channel). Just because you set an alpha value however, doesn't mean your program will use it - you have to detect the value and set alpha blending when rendering your meshes.

Share this post


Link to post
Share on other sites
Trounce    122
Ah perfect. Now I can test for opacity no problem -- which was half the battle. :)

...but I just don't know what to do with it. There are a large amount of Alpha related functions, and I'm not sure which I need use. The parts of the mesh that I want to blend don't have textures applied. I'm not sure if that complicates things.

Share this post


Link to post
Share on other sites
Trounce    122
Okay, I scoured the 'net and can't find a -single- example on using AlphaBlending with meshes and Managed DirectX (C#). Can any coding guru out there shed some light on this issue?

Share this post


Link to post
Share on other sites
Trip99    577
When you render your mesh I guess you are looping through the subsets. Firstly make sure alpha is on: device->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );

Then render the subsets without alpha (those where material alpha = 1.0f) and then those with alpha and thats about it - you should get transparency showing.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this