Alan Phipps

Hi,

i have a simple project that displays a model. This model is in the .x format and is completely opaque when viewed with the DirectX model viewer. However, when I run the project, the model appears semi-transparent as shown:

http://www.alanphipps.com/temp/dice.jpg

I have searched through the forums and I have changed many of the AlphaBlend/Renderstate options, having them as both true and false, but to no avail.

does anyone now how to make my model opaque.

thanks

ps. The project is basically a copy of the "How to: Render a Model" tutorial from the XNA GSE help files



Re: XNA Framework Model appers semi-transparent

Bernhard Wolkerstorfer

Looks like you have set the wrong CullMode.
Just try to set it to CullMode.None and test it again. If it displays correct, check the indices order. All triangles that have indices counter-clockwise (from camera) are cut away.




Re: XNA Framework Model appers semi-transparent

Alan Phipps

I tried all 3 cullmode options, it is still displayed as transparent.

any other ideas

ta





Re: XNA Framework Model appers semi-transparent

Wil Burton

I had similar results when I tried to use multiple viewports.  I had to set the MinDepth/MaxDepth and then it looked correct again.  See this thread:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1073993&SiteID=1





Re: XNA Framework Model appers semi-transparent

Steven Ashley

I had the same problem but fixed it by enabling the depth buffer immediately before rendering a mesh.

graphics.GraphicsDevice.RenderState.DepthBufferEnable = true;

Enabling the depth buffer inside LoadGraphicsContent or after the model had been rendered had no affect. I suspect that something is resetting it between frames. (perhaps rendering a sprite )

Cheers :)




Re: XNA Framework Model appers semi-transparent

Alan Phipps

Thanks guys,

In the end I changed this:

graphics.GraphicsDevice.Clear(ClearOptions.DepthBuffer, Color.Black, 1.0F, 0);

to this:

graphics.GraphicsDevice.Clear(Color.Black);

and it worked

Thanks for your help.

ta