Questions tagged [stencil-buffer]

The stencil buffer is a concept implemented in various 3D graphics APIs used for performing "stencil" operations, used to minimize rasterization of hidden pixels or to implement various effects.

Resources:

202 questions
16
votes
0 answers

Unity 3D HDRP - Making a hole in a gameobject by shader using stencil

Unity version 2019.1.2f1 HDRP project. I am trying to make a hole in a finished gameobject which has a material and shader don't want to interfere with, the point being this should work with any object it is done on. I found this approach somewhere…
Alx
  • 651
  • 1
  • 9
  • 26
8
votes
2 answers

How to create Stencil buffer with texture (Image) in OpenGL-ES 2.0

Can I have Stencil prepared with a texture (Image) in OpenGL 2.0 So that some part of the Image will be transparent and as a result it will be transfered as is to Stencil buffer and then will use this use this stencil buffer for further…
infiniteLoop
  • 2,135
  • 1
  • 25
  • 29
8
votes
2 answers

Writing to the OpenGL Stencil Buffer

I've been reading about the stencil buffer in OpenGL. The basic concept makes sense; a fragment is only drawn if it meets a certain condition after being bitwise ANDed with a value in the stencil buffer. But one thing I don't understand is how you…
paper man
  • 488
  • 5
  • 19
8
votes
1 answer

How stencil buffer and masking work?

I want to draw object in just specific area. Please take a look this image for reference The 2 triangles (picture A) being draw just in the area inside the quad (picture B), so the result will look clipped (picture C). First i draw the quad just…
janucaria
  • 191
  • 2
  • 12
8
votes
2 answers

opengl - how to implement "portal rendering"

I've been trying to implement something like the game Antichamber (to be more precisly this trick shown below) for the past week: Here's a video of what I'm hoping to achieve (even though it was done with the Unreal Engine 4; I'm not using that):…
Beriol
  • 646
  • 1
  • 10
  • 25
7
votes
1 answer

OpenGL stencil buffer OR operation?

I'm not sure if this is possible to do, but it's worth a shot. I'm using the stencil buffer to reduce overdraw for light volumes in a deferred renderer using this algorithm (when the camera is outside the volume): Using a cheap shader, draw back…
Gumgo
  • 526
  • 4
  • 16
7
votes
1 answer

how to realize z-fail algorithm in opengl?

I code as the NeHe tutors Lesson27 told me,but it's a z-pass algorithm.when i'm in the shadow,the shadow is gone.somebody told me I can use z-fail algorithm to solve this problem. so I spend two days to research z-fail algorithm.At last ,I can't…
nomorefancy
  • 113
  • 7
6
votes
4 answers

Getting the OpenGL-ES Stencil Buffer Working

With the stencil buffer in opengl-es for Android, I'm simply trying to mask out drawing part of the screen. I think I have it set up right, but it is not masking out the non-stenciled parts. Below is an extraction of code for what I'm…
Moncader
  • 3,388
  • 3
  • 22
  • 28
6
votes
1 answer

Libgdx Does SpriteBatch draws to StencilBuffer?

I am using libgdx with OpenGL ES 1.0 and I am wondering if the SpriteBatch can write/draw to the stencil buffer. I've been trying to write to it and I don't get any results at all, I don't have experience using the stencil buffer but I've been…
Leonso Medina Lopez
  • 777
  • 1
  • 10
  • 21
5
votes
1 answer

Combining multiple stencils in GL

I want to set up multiple stencils in OpenGL and then draw into multiple combinations of them. For example: I have two rectangular stencils like this: Then I want to draw into: anywhere left rectangle (blue+purple) right rectangle…
5
votes
1 answer

Using OpenGL ES 2.0 FrameBuffer (FBO) and Stencil in android Native code (ndk)

I am trying to generate a frambuffer object and use stencil inside a native android application using the NDK (r5b). Target device is running froyo 2.2, supporting OpenGL ES 2.0. So, I've been coding lots of gl code in my c++ native libs and havent…
oberthelot
  • 1,310
  • 1
  • 11
  • 23
5
votes
1 answer

How to use stencils with SCNTechnique?

Basically, I would like to render an outline around a cube. To do this, I think I can use an SCNTechnique which has the following render passes: Render the cubes normally, and also write their occupied pixels to a stencil buffer. Render slightly…
Robert
  • 5,735
  • 3
  • 40
  • 53
5
votes
3 answers

Is the stencil buffer still relevant in modern OpenGL?

Me and a friend have been having an ongoing argument about the stencil buffer. In short I haven't been able to find a situation where the stencil buffer would provide any advantage over the programmable pipeline tools in OpenGL 3.2+. Are there any…
claudehenry
  • 736
  • 8
  • 17
5
votes
1 answer

Stenciling textures in OpenGL ES 2.0

I have been trying to do some stenciling in a Libgdx project. So far, I have only been able to stencil out polygons (Code after the illustration). QUESTION: How am I supposed to stencil out non-polygonal shapes in OpenGL ES 2.0? (i.e. I don't want…
Rafay
  • 6,108
  • 11
  • 51
  • 71
5
votes
1 answer

Use stencil buffer with iOS

I try to use the "stencil buffer" to display a part of my rendering from a texture, but my render is displayed without any mask effect. It's for a 2D iOS project, with OpenGL ES 2.0 This is the concerned part of my code : glClear(…
EricD
  • 587
  • 6
  • 22
1
2 3
13 14