• Advertisement
Sign in to follow this  

Render target not behaving as expected

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

Hi Guys,

I am having trouble understanding why a render target is behaving the way it is.

I have a render target that I am using as the texture source of a shader, which is working great. Using a perspective camera by the way.

I now want to decrease the resolution of the render target to half of the size of the main window, so I can use this as the start of a blur shader (so far it is just the horizontal pass).

When I render this back to the screen it is displaying at double size. Being a perspective camera I would have just expected it to look the same (but obviously half resolution, stretched to fit the screen).

3AkWT6D.png

In the image both circles are rendered at the same location. The blurred circle is the render target texture being drawn back to the screen. The debugger shows the texture as the same as above too (minus the solid circle - that is drawn after the RT is drawn back). The debugger also verifies that the back buffer is 1280 x 720 and the Render Target is 720 x 360.

I have double checked through my code and can't see any reason for what is going on.

If the screen size and RT size match, the circles line up perfectly.

Any advice on where I might be going wrong would be awesome.

Thanks in advance smile.png

Share this post


Link to post
Share on other sites
Advertisement

Do you set an appropriate viewport when you change render-targets? D3D9 used to do this automagically, but IIRC D3D11 doesn't.

 

When doing your blurring, etc, how are you generating the vertex positions for the corners of your quad? Are you using NDC coordinates directly, or are you computing them via a projection matrix?

 

Have you run your program through RenderDoc to see at which stage the bug occurs?

Share this post


Link to post
Share on other sites
Hi Hodgman, thanks for the reply.

No, I am not changing viewports. So, you have probably hit the nail on the head. I'll take a look at that.

The quad that renders back is simply x +/-1 to y +/-1 in screen space.

Will have a look at the view port and get back to you. smile.png

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement