making a making a water effect in DirectX11 using 2 render targets - one with a reflection texture and one with a refraction texture, which I blend together in the shader.
As you can see, the refracted image works fine, but the reflected image is cut off, and if you go really close to it and look straight down, you can also see many copies of the reflected texture inside the reflection texture, so it seems it's being tiled somehow. It looks like it is being drawn to a render target that is way too small for some reason.
No idea why this is because the same dimensions - screenwidth and screenheight - are passed in when initializing both the refraction and reflection render targets.
So my only guess is it's in the watershader.ps and how the tex coordinates are being scaled somehow?
In Graphics.cpp, result = _ReflectionTexture->Initialize(_D3D->GetDevice(), screenWidth, screenHeight);
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 or bigger than render target, 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. (See images of the water demo and a simpler demo with reflection only for reference. Both have the exact same problem with reflection, as you can see).
reflection with watersimple reflection
Aucun commentaire:
Enregistrer un commentaire