DirectX11 Reflection - Image cut off in render target

Associate
Joined
28 Oct 2017
Posts
2
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
 
It's hard to tell without a screenshot but it sounds like your reflection view matrix might be wrong. I've had a quick look at the code and shader and can't see anything obviously wrong.
 
Back
Top Bottom