[V ENB] Render Target issue

fixing bugs
Post Reply
  • Author
  • Message
Offline
User avatar
*master*
Posts: 119
Joined: 05 Jan 2012, 22:34
Location: France

[V ENB] Render Target issue

Hey Boris,

Is there a way to fix this issue or at least if you can point me to the correct direction to fix it :
In a shader, discard the pixels like
clip(coord.x > 0.5 || coord.y > 0.5 ? -1 : 1);


Using RenderTargetRGB32F, it generates garbage as it's not clearing it up.
Using RenderTargetRGBA64F, it keeps the image in the buffer and does not clean it.

My expected behaviour was black, it shows me garbage from the RenderTargetR16F buffer.
Image

I know it's an odd thing to try but I was testing something.

Thank you :)

EDIT : Solved, check Kitsune's method.
Last edited by icelaglace on 09 May 2020, 14:07, edited 1 time in total.

Offline
Posts: 24
Joined: 01 Nov 2018, 21:02

Re: [V ENB] Render Target issue

I usually fixed these issues by adding a second pass to the technique to clear out the render target beforehand. Something like that:

Code: Select all

//Pseudocode:
technique ExampleTech
{
    pass 0 { /* PixelShader that returns 0.0 */ }
    pass 1 { /* PixelShader with clipping op */ }
}
Alternatively you could also return 0.0 directly instead of discarding pixels by using if(any(coords > 0.5)) return 0.0;. Depending on what you want to do with your shader.

Offline
User avatar
*master*
Posts: 119
Joined: 05 Jan 2012, 22:34
Location: France

Re: [V ENB] Render Target issue

Thank you Kitsune!

I actually did try the same method earlier, it worked fine when I tried to clean up before writing new stuff on the render target. :)

I reported this because it's usually much better to clear the context on the CPU side rather than the GPU side.
Writing 0 as a pass is a hack, while working, isn't ideal. :mrgreen:

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17559
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: [V ENB] Render Target issue

I dont know which render targets will be used, so prefer to not waste performance cleanup them all. So yeah, extra prepass is good thing and the only one (and much better than using "if") condition.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*master*
Posts: 119
Joined: 05 Jan 2012, 22:34
Location: France

Re: [V ENB] Render Target issue

Fair enough!
Thank you Boris!
Post Reply