Jump to content
  • Advertisement
Sign in to follow this  
MajSlayer

3DS Glass is not See-Thru

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

I've had this problem with 3DS glass meterial objects I export to XNA, Seems there not see-thru at all, I can't get them to display correctly, they look solid. Has anyone else ran into this, I figure I'm just doing something wrong:( Oh I'm exporting to .3DS then exporting from Deep Exploration to a .x file. Thanks, MajSlayer

Share this post


Link to post
Share on other sites
Advertisement
3DS materials aren't exported when you export a mesh. For those effects you'd need to export the mesh and then do transparency with shaders and XNA.
Unless you're referring to HLSL in 3DS Max which I'm not sure about. That may depend on the exporter.

Share this post


Link to post
Share on other sites
How does one go about doing that? do I apply commands to the object in question(via its name)?
Kinda new and I need to get this window working, I'll study up in the mean time. Thanks I had no idea why it wasn't working,

MajSlayer

Share this post


Link to post
Share on other sites

Transparent materials are typically rendered using alpha blending, you can set that up with the code below.


GraphicsDevice.RenderState.AlphaBlendEnable = true;
GraphicsDevice.RenderState.SourceBlend = Blend.SourceAlpha;
GraphicsDevice.RenderState.DestinationBlend = Blend.InverseSourceAlpha;

// render transparent meshpart here

GraphicsDevice.RenderState.AlphaBlendEnable = false;


However, rendering transparent materials isn't quite as straightforward as you might think. Because of depth buffering, if you render your transparent material before you render the stuff that's behind it, it won't be there. The device doesn't care if an object is transparent (with alphablending, alphatesting is another matter), so it'll mark the pixels as 'taken' in the depth buffer and discard any pixels rendered behind it. A bit of googling should provide you with more in depth info.

There are basically two ways around this, sorting materials so you render the transparent ones last or disabling zbuffer writes when rendering transparent materials. Disabling the zbuffer writes is only useful if you don't care the transparent material gets overwritten (common with grass and foilage), so I'm afraid you're going to have to do some sorting. For a single mesh though, this is just a matter of figuring out the MeshPart index which uses the transparent material and rendering that after you've looped over the opaque parts.

There you go, I hope this makes some sense [smile]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!