Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Independent clip() in Multiple Render Targets


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 davis31   Members   -  Reputation: 102

Like
0Likes
Like

Posted 16 August 2012 - 04:48 AM

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

Sponsor:

#2 DJTN   Members   -  Reputation: 207

Like
1Likes
Like

Posted 16 August 2012 - 06:09 AM

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.

#3 Hodgman   Moderators   -  Reputation: 31786

Like
0Likes
Like

Posted 16 August 2012 - 06:10 AM

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 (two triangles covering the same pixel), 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.

#4 davis31   Members   -  Reputation: 102

Like
0Likes
Like

Posted 16 August 2012 - 08:20 AM

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 (two triangles covering the same pixel), 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.


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

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.


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

#5 pcmaster   Members   -  Reputation: 685

Like
0Likes
Like

Posted 17 August 2012 - 01:57 AM

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?

#6 DJTN   Members   -  Reputation: 207

Like
0Likes
Like

Posted 17 August 2012 - 09:15 AM

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



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?


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...




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS