Questions tagged [stencil-buffer]
9 questions
35
votes
3 answers
What is a stencil buffer?
Wikipedia states that a stencil buffer is some arbitrary buffer a shader can use.
However, it hints that it's used for clipping, or otherwise "tightly binding" the depth and pixel buffers, slightly contradicting itself.
What does the stencil buffer…
Qix - MONICA WAS MISTREATED
- 609
- 1
- 5
- 14
6
votes
2 answers
Uses for Stencil Buffer
I've been doing OpenGL tutorials using LearnOpenGL. Currently I'm reading about Stencil Buffers and in his example he uses a Stencil Buffer to draw an outline around an object. I've also read that it can be used to create shadows and reflections. My…
Archmede
- 411
- 2
- 7
- 18
6
votes
0 answers
How much processing power does stenciling actually save?
For example, let's assume I'm rendering cascaded shadow mapping, but for whatever reason, instead of one of the typical approach, I do the following:
Render the lowest resolution shadowmap
Copy part of the shadowmap to the next shadowmap, covering…
Llamageddon
- 881
- 2
- 7
- 13
4
votes
0 answers
selectively setting stencil value based on vertex property in vertex shader
Just like the question says. Is it possible to selectively set the value of the stencil buffer based on a property of a vertex, like the value of its normal, during its vertex processing phase? Instead of setting for all fragments of the model.…
cybergla
- 41
- 2
3
votes
1 answer
Incorrect values written in stencil buffer
I am trying to pick objects on mouse click. For this I have followed this tutorial, and tried to use the stencil buffer for this purpose.
Inside "game" loop I am trying to draw 10 (5 pairs) 'pick'able triangles as follows:
...
glClearColor(red,…
Sayan Pal
- 263
- 1
- 8
2
votes
3 answers
Fast clipping without clearing stencil buffer
I'm writing an OpenGL application that runs on a Raspberry Pi, i.e., a quite resource-limited system. Essentially, a few quads with RGBA textures are overlayed/alpha blended on top of each other with individual translation/rotation applied. They are…
Jonas Mechtheim
- 45
- 4
2
votes
1 answer
Layer rendering in Vulkan
I am writing a Vulkan video manipulation engine which has the following layers:
Foreground (2D)
Scene (3D)
Background (2D)
Note that each layer may have multiple objects, some of which may be transparent. For 2D objects (foreground and…
1
vote
0 answers
3D model outline using stencil buffer
I'm trying to outline a 3D model in WebGL. I've tried using a stencil buffer techique with glLineWidth and glPolygonMode. However, Mozilla's WebGL reference says that the minimum and maximum widths of lines are 1 (therefore can't be modified). I've…
Daniel Marques
- 163
- 6
1
vote
1 answer
Problem using Decaling with Stencil to avoid Z-fighting
I need to create a decaling into a surface like a mesh, and to avoid Z-fighting I've been using Stencil Buffer to Turn-off depth test and make the decaling over the surface the Stencil Op permits. In fact that decaling fails when we turn the camera…
lealericsson
- 11
- 2