Jump to content
  • Advertisement
Sign in to follow this  
CastorX

Mirror

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

Hello! Q1: How can I render the scene onto a mirror, without doble rendering? I mean that I want to draw the whole scene only one time. Is it able? Q2: I would like to render glass effect, with one booth, so I need the content of the backbuffer. That's OK. But HOW can I use the back buffer as a texture; or I need to render the scene onto a texture, without the backbuffer, and then render that texture with the HLSL-shadered scree-quad? Thanx!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by CastorX
Hello!
Q1: How can I render the scene onto a mirror, without doble rendering? I mean that I want to draw the whole scene only one time. Is it able?

No, it's not possible. You have to render the scene, and you have to render the reflection. If your scenes are static, you can generate environment maps for them as a preprocessing step, and use these for reflection.

Quote:
Q2: I would like to render glass effect, with one booth, so I need the content of the backbuffer. That's OK. But HOW can I use the back buffer as a texture; or I need to render the scene onto a texture, without the backbuffer, and then render that texture with the HLSL-shadered scree-quad?

- booth?
- Render the scene to a texture, then render the texture with a screen-sized quad.

Share this post


Link to post
Share on other sites
Hi there CastorX,
How are you doing?

The Problem
How to create a mirror effect, basically reflecting.

The Solution
There are a number of ways to do this. But I don't know of a possible solution that you can just render the entire scene once to get a mirror effect.

The general approach:
- Render to Texture.
- Create a render target using D3DXCreateTexture and the flag
D3DUSAGE_RENDERTARGET
- Save the current back buffer.
- Set the newly created texture as a back buffer
- Render your scene from the mirror's view to the render target (texture)
- Replace the old render target (back buffer)
- Render the mirror with the texture applied (render target texture)

- You could also use stenciling to clip the mirror so that only the mirror shows
reflected parts.

I hope this helps a bit bud.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!