1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

DirectX11 Reflection - Image cut off in render target

Discussion in 'HTML, Graphics & Programming' started by mister345, 26 Nov 2017.

  1. mister345


    Joined: 28 Oct 2017

    Posts: 2

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


    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.

  2. Baboonanza

    Wise Guy

    Joined: 10 Nov 2009

    Posts: 1,093

    Location: London

    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.