Hi,
I’m trying to find how to use the stencil buffer in UE4 but found nothing yet.
Can someone help me and point to the documentation or some examples?
Thank you,
Hi,
I’m trying to find how to use the stencil buffer in UE4 but found nothing yet.
Can someone help me and point to the documentation or some examples?
Thank you,
Hey Dest8 -
The Stencil Buffer is not exposed by default to Blueprints or Materials however you should be able to call it through the code. Run a Search in the API for Stencil Buffer and you can see where we are using, https://docs.unrealengine.com/latest/INT/Search/index.html?q=Stencil+Buffer&filter=documentation&x=16&y=7
Thank You
Eric Ketchum
Hi Eric,
Can you please give some example of it’s usage from the game side?
Thank you,
There’s no way to use the stencil buffer from the game side, it’s a temporary rendering resource and can only be used as a scratch pad during a single rendering pass (not for the whole frame).
Within the renderer it can be operated on with RHI commands, for example RHICmdList.SetDepthStencilState. The standard pattern is first clear to 0, then setup stencil state to write 1, then draw some geometry to setup the mask, then set stencil state to only pass if 1, then draw something that you want to be clipped to the region of the first draw call.
Hey ,
Sorry to bump an old question - but is it possible to use the Stencil Buffer to do something like this? I’m essentially trying to create a HMD view with no distortion, and an angled split instead of a vertical one.