• Advertisement
Sign in to follow this  

Independent clip() in Multiple Render Targets

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

Hello,

a few days ago I introduced Multiple Render Targets (MRT) to my render.
In the previous implementation I used the clip() HLSL function to perform alpha testing in my pixel shader. The problem is that now, when using MRT I want to use the clip on the first render target but not on the other ones. If I use the clip function it clips not only the first render target but also the other ones.

Is there any way to specify which render targets should be clipped and which not? Or is there a way to specify "not drawing" as the return color of an specific render target?

I'm using DirectX9.

Thank you in advance,

David

Share this post


Link to post
Share on other sites
Advertisement
If you're using a pixel shader, you can create another technique that doesn't use the clip funtion and use it for those RTs.

Rememeber that clip doesn't return anything for that pixel, nor does it write any information to the back buffer or depth buffer. On newer graphic cards it stops the execution entirely.

Share this post


Link to post
Share on other sites
There's some tricks you could do in DX10/11 for this, but I don't know of any in DX9.

The only hack I can think of is:
If you can guarantee that you've got no overdraw ([i]two triangles covering the same pixel[/i]), which you can if you're doing a z-pre-pass, then you can render with additive blending and output black when you don't want to write data.

Share this post


Link to post
Share on other sites
[quote name='Hodgman' timestamp='1345119059' post='4970122']
There's some tricks you could do in DX10/11 for this, but I don't know of any in DX9.

The only hack I can think of is:
If you can guarantee that you've got no overdraw ([i]two triangles covering the same pixel[/i]), which you can if you're doing a z-pre-pass, then you can render with additive blending and output black when you don't want to write data.
[/quote]

Yes, I had the same idea, but I'm not doing a z-pre-pass right now and I don't know if it would be too expensive. In any case, I'm pretty sure this solution would work, but I'll leave it as the last option :P

[quote name='DJTN' timestamp='1345118997' post='4970121']
If you're using a pixel shader, you can create another technique that doesn't use the clip funtion and use it for those RTs.

Rememeber that clip doesn't return anything for that pixel, nor does it write any information to the back buffer or depth buffer. On newer graphic cards it stops the execution entirely.
[/quote]

That would work. But is it possible to use different techniques, for the different RT when using MRT?? If it is possible, could you give an example or a resource explaining how to do that? I've not been able to find any :S

Share this post


Link to post
Share on other sites
You cannot have different effects (nor techniques (nor passes)) for the individual parts of the MRT, of course. Not even in DX11. Am I right?

Share this post


Link to post
Share on other sites
[quote name='davis31' timestamp='1345126854' post='4970183']
That would work. But is it possible to use different techniques, for the different RT when using MRT?? If it is possible, could you give an example or a resource explaining how to do that? I've not been able to find any :S
[/quote]


[quote name='pcmaster' timestamp='1345190278' post='4970460']
You cannot have different effects (nor techniques (nor passes)) for the individual parts of the MRT, of course. Not even in DX11. Am I right?
[/quote]

I should have been more specific, when I said RT's... I meant "RT" not "MRT". This would require multiple passes for each RT (surface).

I assumed you knew that you cannot render MRT's with multiple effects, multiple techniques, different bit depth, different width, different height, etc... in dx9 with MRT's.

MRT (Multiple Render Targets) = one pass.
Multiple RT's (several separate Render Targets) = multiple passes.


I apologize if I confused anyone...

Share this post


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

  • Advertisement