Translucency with Reflections?

rated by 0 users
This post has 2 Replies | 2 Followers

Top 50 Contributor
Posts 105
SunBurn_Community_Licensee
SunBurn_Contributor
FrontlineFire Posted: 06-06-2012 7:03 PM

Is there an easy way to get the reflection tech and translucency working?

As well, reflections in general? They are not part of the stock shaders.

 

Thank you!

Top 10 Contributor
Posts 5,379
Employee
SunBurn_Studio_Licensee

Hi Frontline,

The Reflection / Refraction example's implementation works great with both opaque and transparent objects.  However you will need to make one quick change:

Comment out the final sceneInterface.EndFrameRendering():

 

            // Done rendering.
            //sceneInterface.EndFrameRendering();
            sceneState.EndFrameRendering();


And move the call to before rendering the objects with reflection:

            // Clear the depth buffer then render.
            graphics.GraphicsDevice.Clear(ClearOptions.DepthBuffer, Color.Black, 1.0f, 0);
            sceneInterface.RenderManager.Render();

            sceneInterface.EndFrameRendering();

            // Setup and render reflective / refractive pass for water and orbs using additive blending.
            GraphicsDevice.BlendState = TrueAdditiveBlend;


This change is necessary because transparent objects are rendered during EndFrameRendering(), and the reflection / refraction layer must be rendered afterward.  The change is compatible with both transparent and opaque objects.

Let me know if this helps!

Follow me on Twitter – development and personal tweets
Awesome XNA Videos – Lighting, Rendering, and game videos

Top 50 Contributor
Posts 105
SunBurn_Community_Licensee
SunBurn_Contributor

Thank you. We'll take a look at this!

Page 1 of 1 (3 items) | RSS