Jump to content
  • Advertisement
mister345

DX11 Reflection effect - Reflected image size gets cut off

Recommended Posts

Hi guys, following Rastertek tutorial and making a reflection effect using render targets in DirectX11.

http://www.rastertek.com/dx11tut27.html

Got it working, but as you can see, the reflected image seems to be drawing to a really small "texture" - 

doesnt correspond to the size of the actual blue floor texture it is being drawn onto.

If you go really close to it and look straight down, you can also see many copies of the reflected texture inside

the blue floor texture, so it seems it's being tiled somehow. But no idea where to change this setting in the code,

or what is the cause of the sizing problem.

 

At line 108 of Graphics.cpp, 

_RenderTexture->Initialize(_D3D->GetDevice(), screenWidth, screenHeight);
 

We give the screenWidth and Height to the render Texture that is later used as the target for the reflected image.

Howver, I tried passing in different values for width and height of this texture and it will stretch or shrink the reflected

image, but then its position in the reflected surface is all messed up. I need the size of that reflection target to be the same size as the

actual blue floor texture, but the images to be scaled properly when they get reflected in that.

 

It doesnt seem to be doing the scaling right at the moment. If you could take a look, any help would be much appreciated. Thanks so much.

https://github.com/mister51213/DirectX11Engine/blob/master/DirectX11Engine/Graphics.cpp

 

 

 

 

 

reflection problem.PNG

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 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!