Opacity in .X Files? Nothing partially transparent.
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!
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.
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.
...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.
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?
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement