Disable near and far clipping (HLSL)
Hi everyone,
I'm rendering a bounding sphere of a light to stencil buffer in order to speed up further expensive lighting pixel shader and I need a way to ignore near and far clipping planes when doing it - otherwise I won't stencil mark all required pixels.
Is there any simple way to do it from HLSL?
Thanks.
What API are you using?
In DirectX9, you would use SetRenderState() and set the D3DRS_CLIPPING render state to false to disable clipping.
In DirectX9, you would use SetRenderState() and set the D3DRS_CLIPPING render state to false to disable clipping.
Thanks,
Having thought of this for some time, I've just came to a different solution which will allow me for much better pixel shader bandwidth optimization - using stencil increase and decrease operation (like with shadow volumes) to mask out light area.
Having thought of this for some time, I've just came to a different solution which will allow me for much better pixel shader bandwidth optimization - using stencil increase and decrease operation (like with shadow volumes) to mask out light area.
Instead of a bounding sphere, I'd recommend finding a square that encompasses the light area in screenspace (like a billboard) and stencil, heck, even scissor, against that.
Not all GPUs are capable of disabling clipping. I think that state is really for the software pipeline.
For instance, nvidia GPU's can't disable clipping.
For instance, nvidia GPU's can't disable clipping.
Quote:Original post by Cypher19
Instead of a bounding sphere, I'd recommend finding a square that encompasses the light area in screenspace (like a billboard) and stencil, heck, even scissor, against that.
I'm using scissor test too.
But hence that rendering bounding sphere to stencil buffer using incr-decr schema will determine only the pixels within light's "radius". It's quite common that the scissor rectangle takes half a screen, while stencil test leaves only a few pixels - this is because bounding sphere clips along Z coordinate too.
forgive me for my ignorance, but how is this better than standard per vertes is-out-of-range check?
Quote:Original post by Code-R
forgive me for my ignorance, but how is this better than standard per vertes is-out-of-range check?
When you do per-vertex (geometry) clipping, you can avoid rendering few triangles. But when you do per-pixel stencil clipping, you can clip single pixels. Only these pixels will be drawn to color buffer in consecutive rendering pass - in my case it uses an expensive pixel shader.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement