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
1
vote
0 answers

Three.js - Stencil only on certain objects

I'm looking into making kind of a portal effect using Three.js. The main idea is to be able to see through multiple windows another Scene. Exactly like in this example : https://www.ronja-tutorials.com/post/022-stencil-buffers/ (See gif in article,…
Anat
  • 11
  • 2
1
vote
1 answer

OpenGL trim/inline contour of stencil

I have created a shape in my stencil buffer (black in the picture below). Now I would like to render to the backbuffer. I would like one texture on the outer pixels (say 4 pixels) of my stencil (red), and an other texture on the remaining pixels…
XPlatformer
  • 1,148
  • 8
  • 18
1
vote
1 answer

OpenGL How to write to stencil buffer when stencil test fails and depth test succeeds?

I'm trying to implement an effect in my program where i render the silouette of an object when it's behind other objects, similar to how it's done here: https://i.pinimg.com/originals/87/8f/c4/878fc47a5bd6d62dfbaec3520cb4d9f5.jpg What i want is to…
1
vote
0 answers

Cutting holes through UI images in Unity using stencil buffers and shaders

There is a way to make holes in Unity, aka an x-ray vision, see the figure below: This is done using two shaders, one having configuration A (cutter) and another - configuration B (target). The shader with configuration A is put into material A and…
AlexB
  • 33
  • 5
1
vote
1 answer

Does discard in fragment shader prevent modifications to stencil buffer?

I want to have discard in my fragment shader prevent that fragment from writing to the stencil buffer; I had an idea for a visual effect in my game, and it might be implementable if I can rely on that behaviour for discard. My fragment shader…
Mr. Smith
  • 4,288
  • 7
  • 40
  • 82
1
vote
0 answers

Three.js: Trouble combining stencil clipping with EffectComposer

NOTE: It appears I oversimplified my initial question. See below for the edit. I'm trying to combine the technique shown in the clipping/stencil example of Three.js, which uses the stencil buffer to render 'caps' when clipping geometry, with an…
FalconNL
  • 1,603
  • 2
  • 13
  • 17
1
vote
1 answer

Using stencil buffer in Direct3D

I'm trying to use stencil buffers on ID3D11Texture2D to overlay a portion of one texture on another texture. I plan to do this by drawing the desired shape on the stencil buffer and then copying the texture. Please suggest some good tutorial with…
N.R.S.Sowrabh
  • 725
  • 13
  • 30
1
vote
1 answer

Why GL_RASTERIZER_DISCARD does not enable me to write to stencil buffer?

I want to draw outline with stencil buffer in 3 passes. normal drawing pass outline mask generating pass outline drawing pass the second pass does not need fragment shader to work, because it only writes to stencil buffer, so I use…
BrodaJarek3
  • 311
  • 1
  • 9
1
vote
2 answers

How do values get drawn to the stencil buffer in this example?

I have a serious problem understanding how stencil buffering in OpenGL works. I followed the examples of a tutorial and the code works of course, but I really don't get at what points I'm writing to the stencil buffer. To me it seems as I'm setting…
1
vote
1 answer

glStencilFunc(): why is GL_ALWAYS != GL_EQUAL union GL_NOTEQUAL?

I want to be able to clip my postprocessing image passes to specific regions so that effects such as a blur would only affect theses regions In order to do that i use the stencil buffer and my pipeline is as follows : Render some objects to the…
1
vote
0 answers

The stencil buffer doesn’t draw a part of the tiles

Well, I’m trying to draw tiles into a stencil buffer, but while drawing obviously happens something that I don’t understand and during the drawing disappearing (not drawn) part of the tiles. So, how I draw: // Enable…
evaee
  • 11
  • 4
1
vote
1 answer

Depth test not working correctly with stencil test

I need to cut holes in the 3D surface using stencil buffer. Currently, everything works as expected, but the main problem is that holes are also visible through hills. How to prevent this behavior and hide holes if they are behind hills? Current…
Ololoking
  • 1,577
  • 4
  • 22
  • 37
1
vote
1 answer

Slow stencil texture on AMD

I'm trying to add soft shadows to a modified Doom3 engine using FBO + stencil texture attachment that I bind and use in the light interaction fragment shader. It works good enough, but there's a serious performance problem on a Radeon 460 (I don't…
Anton Duzenko
  • 2,366
  • 1
  • 21
  • 26
1
vote
1 answer

Stencil buffer behaviour in simple case (GL_ALWAYS, GL_LEQUAL)

I don't understand why those two codes doesn't yield the same result. I have enabled depth testing and stencil testing and my main loop looks like this : myShader.Use() // Use shader program glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT |…
Desura
  • 165
  • 1
  • 4
  • 11
1
vote
0 answers

Stencil Start Error "Error: components\\stencil\\maintenanceNotice\\component.scss doesn\'t exist!\"

I've come across this error message when I run "stencil start". Any advise? { Error: components\stencil\maintenanceNotice\component.scss doesn't exist! at options.error…
m.ay
  • 11
  • 1