🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Stencil shadow volumes without stencil usage

Started by
3 comments, last by _Silence_ 5 years, 4 months ago

I just found that using stencil in a framebuffer aint supported by the hardware and its emulated in software mode, now i wonder if i could somehow use a stencill pass in fragment shader, i need to combine whenever a z test fails or passes, thus i dont even know if this can be done - from my understanding only those fragments are passed to fragment shader which pass depth test right? - so maybe using diffrent glDepthFunc() would do the trick.

TRUE or FALSE?

Maybe theres a simplier solution?

Advertisement
9 minutes ago, _WeirdCat_ said:

I just found that using stencil in a framebuffer aint supported by the hardware and its emulated in software mode

What?

9 minutes ago, _WeirdCat_ said:

i need to combine whenever a z test fails or passes, thus i dont even know if this can be done - from my understanding only those fragments are passed to fragment shader which pass depth test right?

To get depth pass/fail info in a pixel shader, you'll have to implement z-buffering yourself in the pixel shader, by making your own "depth buffer" that's bound as a read-write texture (D3D: UAV / GL: Image). This sounds horribly slow though, so you should probably use the hardware depth/stencil as usual...?

Oh thats a good idea i just clear hw depth buffer and draw caps where i test from a depth tex if it fails or not.

 

About that first quote, 

    glFramebufferRenderbuffer(GL_FRAMEBUFFER,
                                      GL_DEPTH_STENCIL_ATTACHMENT,
                                      GL_RENDERBUFFER,
                                      RBO_ID);

That what is causing framerate drop, i tried it with a framebiffers that even dont use stencil and simple drawing of a box takes about 1 second

4 hours ago, _WeirdCat_ said:

glFramebufferRenderbuffer(GL_FRAMEBUFFER,
                                      GL_DEPTH_STENCIL_ATTACHMENT,
                                      GL_RENDERBUFFER,
                                      RBO_ID);

Why using a renderbuffer and not simply a texture attachment ?

Also try to explicitly give the good format, ie GL_STENCIL_INDEX8 (or similar if it exists on GLES). If you also need depth, GL_DEPTH24_STENCIL8 should be good (check GLES if such exist).

18 hours ago, _WeirdCat_ said:

I just found that using stencil in a framebuffer aint supported by the hardware and its emulated in software mode

 

4 hours ago, _WeirdCat_ said:

That what is causing framerate drop, i tried it with a framebiffers that even dont use stencil and simple drawing of a box takes about 1 second

This looks weird to me. And that doesn't mean this is emulated in software.

This topic is closed to new replies.

Advertisement