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
4
votes
1 answer

Visualizing the Stencil Buffer to a texture

I'm trying to put the stencil buffer into a texture for use in a deferred renderer. I'm getting other Color and Depth Attachments with glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textures[color1], 0); and the result…
Chase Walden
  • 1,252
  • 1
  • 14
  • 31
4
votes
1 answer

Depth stencil not working - DirectX 10 C++

I have a DirectX10 + C++ problem. Basically we're at the early stages of rendering, and for some reason our depth stencil seems to be failing to understand our model. Basically, here is everything we are doing: Load shader, model and…
Zantom07
  • 61
  • 4
4
votes
3 answers

Stenciling using OpenGl ES 2.0

I am trying to figure out a way to cut out a certain region of a background texture such that a certain custom pattern is not rendered on the screen for that background. For example: This square can be any pattern. I am using Frame Buffer Object…
Rafay
  • 6,108
  • 11
  • 51
  • 71
4
votes
1 answer

Portals in OpenGL using Stencil Buffer - how to avoid drawing things in front of the portal?

I'm trying to realize portals using OpenGL via the stencil buffer. The technique seems simple enough to me: render the portal into the stencil buffer, render the scene as viewed from the virtual camera behind the target portal (restricted to the…
Hovering
  • 73
  • 6
3
votes
1 answer

OpenGL, stencil buffer of FBO not working?

I try to use the stencil buffer of a FBO in OpenGL, but I can't get it to work. I bound a depth24_stencil8 texture to the FBO both for the depth and stencil targets. As a simple test, I tried: /* Enable FBO…
neodelphi
  • 2,706
  • 1
  • 15
  • 22
3
votes
2 answers

How to write dynamically to whole stencil buffer in Unity

What do I want to achieve ? I'd like to achieve an effect in Unity3D, where I superpose a few cameras on top of each other. Each cameras would draw to a specific area of the screen. If possible, I'd like these areas to change dynamically. I am using…
Eyap
  • 754
  • 1
  • 7
  • 22
3
votes
2 answers

opengl stencil buffer not initialized with zero?

I work under MS WindowsXP,my video card is itel GMA4500, my code: glClearStencil(0); glClear(GL_STENCIL_BUFFER_BIT); unsigned char* data = new unsigned…
user897101
  • 31
  • 1
3
votes
0 answers

Using the stencil buffer to merge dynamic shadow

I'm making a splitscreen coop 2D from-the-top game with LWJGL. I'm currently trying to figure a smart way of merging two field of vision with the stencil buffer. The whole point is that you are able to see what the other player is able to see. A…
Klems
  • 183
  • 1
  • 2
  • 8
3
votes
1 answer

How to use stencil buffer to achieve hierarchical clipping

What I'm trying to achieve is illustrated on the image below: Let's say we have stencil buffer in a state so only red section is filled at the moment. What actions do I need to perform when I update stencil buffer with a section which is marked…
user3514330
3
votes
1 answer

Strange bugs occur while using stencil testing

I'm making an app which shows a terrain and some custom pits which should be inserted into the terrain. To insert the pits into the terrain I use stencil testing. It works almost great, but some strange bugs are present. The…
Dmitry
  • 2,963
  • 2
  • 21
  • 39
3
votes
0 answers

Metal: using stencil attachment as clipping mask within 2D render tree

I'm currently learning how to use Metal and having some difficulty using the stencil buffer – possibly because its the wrong solution for the problem I have. The problem: I have a tree of 2D render nodes, quads, that I'm rendering with metal. For…
Tricky
  • 7,025
  • 5
  • 33
  • 43
3
votes
1 answer

how to pass stencil from a framebuffer to another

I'm struggling to understand why in the code below, the stencil tests work as expected when i render straight to the screen and doesnt when i attempt to use framebuffers. I have no problem using these framebuffers for multipass postprocessing on…
3
votes
1 answer

Can't get stencil buffers to work in OpenTK, simple 2D quads

I've been trying with no success to get stencil testing to work in my OpenTK 2D game - I want to only draw parts of a texture below values of say 1 in a stencil buffer. Have spent ages reading up on stencils and how they work but can't find a single…
Mr Pie
  • 327
  • 2
  • 11
3
votes
0 answers

Java Using OpenGL Stencil to create Outline

I'm trying to render an outline of an object over the top of it but I'm having some difficulties. I'm not too good with OpenGL so most of it was from following tutorials. The desired effect is supposed to be something like this: But this is the…
user3166950
  • 315
  • 3
  • 6
  • 15
3
votes
1 answer

Depth + Stencil framebuffer concerns

I need both a stencil and depth buffer for my OpenGL app. The depth buffer at least needs to be rendered to texture via a framebuffer object, so that I can do deferred shading and other post-processing effects. I already have this framebuffer set…
Haydn V. Harach
  • 1,265
  • 1
  • 18
  • 36
1 2
3
13 14