XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

Alpha blending question / issue

Last post 1/10/2008 5:00 AM by Henrik Kurelid. 1 replies.
  • 1/10/2008 3:38 AM

    Alpha blending question / issue

    Alpha blending issue:

    The tree model is modeled in Maya using separate TGA files for the model's texture color and the model's texture alpha transparency.

    In Maya, the alpha blending on the model works correctly and the negative space is transparent.

    The model being used was exported as FBX then used in XNA.

    The lines used to draw the model in XNA are:

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

    These lines have worked fine for other models with transparencies, but now with a model using alpha transparency textures, the polygons that include alpha transparency textures are appearing partially transparent, but not according to the texture's alpha transparency value. The polygons that appear partially transparent should appear opaque in positive alpha value areas and transparent in negative alpha value areas.

     

    What is it that I'm missing in order to set the alpha blending settings for the alpha transparency textured models in XNA?

    Any help would be greatly appreciated. Thanks and have a great day.

  • 1/10/2008 5:00 AM In reply to

    Re: Alpha blending question / issue

    I have not used Maya for exporting fbx files myself so I, but here's hat I would say you need to do:
    • Make sure that the alpha texture is exported by Maya along with the color texture.
    • Write a custom content processor that takes care of the extra alpha texture in the fbx file and assign that to the correct variable in your effect (or however you want to store it.)
    • Make sure that the alpha texture sampled in your pixel shader and the value is outputted in the alpha channel.
    The bottom line is that the default model processor does not work for separate alpha textures so you need to handle everything that has to do with that yourself.

    A good place to start would be the NormalMap sample. It does sort of the same thing, but with a separate normal map instead of a alpha map.
    ---
    Sharing my TDD XNA experience on XNA's Nicely Addictive
Page 1 of 1 (2 items) Previous Next