• Advertisement
Sign in to follow this  

[.net] Implement the transparency of a Mesh object

This topic is 3867 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 want to implement the transparency of a Mesh, but i don't how to choose the method . I have create a Mesh object: cuboidMesh = Mesh.Box(d3d.Dx, width,height,depth); When I draw this mesh , I use: dx.Material = GraphicsUtility.InitMaterial(new Color(255,255,0)); cuboidMesh.DrawSubset(0); The ManagedDirectX SDK said that I can use the Material Alpha to get the transparency I use the code which the sdk offered: device.RenderState.DiffuseMaterialSource = ColorSource.Material; Material mtrl = new Material(); Color c = Color.FromArgb(127, 255, 0, 0); mtrl.Diffuse = c; mtrl.Ambient = c; mtrl.Specular = c; mtrl.Emissive = c; device.Material = mtrl; But the result doesn't make sense, I cannot see the object behind this box. Please tell me which wrong I have made, or there's more better methods. I appreciate if you can give some example code. Thank you very much!

Share this post


Link to post
Share on other sites
Advertisement
In which order do you draw the objects?
You should draw the opaque objects first and then the transparent objects for transparency to work.

Share this post


Link to post
Share on other sites
Quote:
Original post by Black Knight
In which order do you draw the objects?
You should draw the opaque objects first and then the transparent objects for transparency to work.



Yes , I do exactly.

But is it important of sequence? If I have many objects, some are transparent, should i draw them after another opaque objects?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement