Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [stencil]

The tag has no usage guidance.

0
votes
0answers
70 views

OpenGL underwater masking using stencils

My goal is rendering some underwater effects (for example depth base fog) when the camera is underwater. The above water and below water are separated by the water plane which is based on the FFT ...
0
votes
2answers
26 views

cutting part of object

How to cut part of the object if it is inside a specific area? like showed on attached image. PS Looks like stencil should be used, but I am not really sure how to do it.
0
votes
0answers
38 views

OpenGL outline of clip plane

I've implemented a clipping and capping view similar to the example called "simplecap.zip" in this page: http://users.polytech.unice.fr/~buffa/cours/synthese_image/DOCS/trant.sgi.com/opengl/examples/...
2
votes
1answer
69 views

How can I make a transparent hole with shaperenderer using stencil masking in libgdx?

I'm making a 2d game, where I need a resizeable, moveable rectangle outline. I'm trying to use stencil masking to do it by cutting a hole in a solid rectangle, and I thought this would help: How can ...
0
votes
1answer
54 views

OpenGL: How to render a “shadow” for an object that's behind another?

First off, an image from Fez that depicts the effect I'm after: I'm trying to achieve a similar effect in my project. I'm quite certain this is done with a stencil buffer, but the resources on such ...
1
vote
0answers
140 views

Recreating A Puzzle Effect Using Stencils

I'm trying to recreate something I saw on reddit a while back. I tried rendering camera output onto planes, but am not getting the results that I want -- this is basically what I'm trying to recreate: ...
0
votes
1answer
93 views

Stencil pass in deferred rendering - far plane

For a long time I was occuring issue with lights which use light volume to reduce fragment shaders run (point, spot). First I use stencil pass to mark pixels which should be processed by fragment ...
0
votes
1answer
1k views

Why my stencil mask doesn't work?

I've a very sipmle Unity scene. It has two objects in it, which is Sprites, and they both use sipmle black boxes as a textures. Here's two shaders, one should act as a mask, and second as a object, ...
0
votes
2answers
1k views

What is the best way to draw outline of object using OpenGL

I want to select the best way to draw outline of 3d human like object and what would be the best way to draw outline for this kind of objects. I found about stencil buffer based methods, geometric ...
0
votes
1answer
172 views

Use an image as mask only where pixels are opaque

We are into a game where to build our tile map, we carve on an image with a mask (At first the whole map is an image, and we create holes on it with tiles to create the map and le the background show. ...
4
votes
1answer
1k views

Selective Image Effects with Stencils

I am trying to create an image effect where only a part of the image has the effect applied to. One way I can think of to do this is to define the portion of the image using the stencil buffer. ...
6
votes
1answer
3k views

How are Stencil Buffer Operations Applied in ShaderLab

In Unity's Shader lab, I've read that the Stencil buffer is implemented with a mask, and an object reacting to the mask. The mask may be defined like the following: ...
1
vote
0answers
268 views

Stencil inside Stencil? (Multiple masks on same object)

So please take a look at what I want to achieve The Red and Blue part is the object I want to mask. The thing is that it will be masked by the green area, and only after that it will be masked by the ...
1
vote
0answers
112 views

Stencil IncrSat and DecrSat explanation

Can someone please explain me what is the purpose of IncrSat and DecrSat? Currently I know that they increment/decrement the current value in the buffer and they make sure the value is between 0 and ...
0
votes
1answer
207 views

Problem with stencil in directx 12

I'm trying to use stencil buffer in directx 12. I have problem that probably is really easy to solve. So, it's look like dx12 ignore it, ClearDepthStencilView() affect only depth, writing to stencil ...
1
vote
2answers
424 views

How to combine depth and stencil tests?

I have a continuous height-mapped mesh to represent landscape. I use the stencil test to create holes in the mesh. I draw holes to the stencil buffer and then use it to discard mesh fragments. ...
-1
votes
0answers
35 views

Create overlapping transparent images [duplicate]

I want to achieve this effect in the image. To make this I don't think a single pass to a stencil buffer would be enough because stencil buffers can't mask out the actual alpha inside of the ...
2
votes
1answer
875 views

Stencil Buffer not working as expected in OpenGL ES 2.0 (Android)

I'm trying to get to grips with the stencil buffer. Apart from setting up viewport, camera, etc, my OpenGL ES 2.0 initialisation code is: ...
5
votes
1answer
2k views

Stencil buffer VS conditional discard in fragment shader

I have a continuous height-mapped mesh to represent landscape. I also have 1 to let's say 10 wells on this landscape represented by additional models. What I want to achieve is to create an illusion ...
2
votes
2answers
876 views

Deferred rendering: camera inside point light's sphere of effect

I'm trying out deferred rendering and I'm using the tutorials at http://ogldev.atspace.co.uk. I've got the basics working and I'm currently trying to implement the final step from tutorial 37 (http://...
3
votes
2answers
4k views

Stencil based mask with alpha

I'm trying to create a fog effect like civ 5: I tried creating a StencilSet shader that receives a mask and sets the stencil buffer to 1. I would render the following on every unexplored tile using ...
1
vote
1answer
240 views

Does glScissor affect stencil and depth buffer operations?

I know glScissor() affects glColorMask() and glDepthMask(), but does it affect the stencil ...
2
votes
1answer
629 views

Correcting Lighting in Stencil Reflections

I'm just playing around with OpenGL seeing how different methods of making shadows and reflections work. I've been following this tutorial which describes using ...
2
votes
1answer
506 views

How stencil buffer and glFrontFace help making a shadow?

I'm trying to understand the tutorial 27th in Nehe website. This is about how to cast a shadow of an object using stencil buffer in OpenGL. The idea here is checking the directions of all the faces of ...
0
votes
1answer
183 views

Shadows go through meshes, and also being applied to itself

I am using Ogre3D and I am using stencil shadows for my character. They work pretty well, but I have 2 problems: first, the shadow is applied to the entity it is casting the shadow, and secondly, the ...
1
vote
1answer
238 views

Can you do a stencil glow with native GM:S commands?

I am looking to a stencil glow on GM:S with d3d_* functions. I could not find anything how to access the stencil buffer though. Is it even possible to access the stencil buffer without using an ...
7
votes
1answer
1k views

Stencil mask with AlphaTestEffect

I am trying to pull off the following effect in XNA 4.0: The purple area has 50% opacity. I have gotten pretty close with the following code: ...
4
votes
2answers
399 views

How can I simulate multiple depth channels?

Here's what I'd like to achieve: Rendering a first pass of objects in my scene, using standard depth comparison Rendering another pass of objects in the same scene, but with the following rules: A ...
1
vote
1answer
311 views

Stencil buffer appears to not be decrementing values correctly

I'm attempting to use the stencil buffer as a clipper for my UI system, but I'm having trouble debugging a problem I'm running in to. This is what I'm doing: A widget can pass a rectangle to the the ...
4
votes
1answer
6k views

How can I write only to the stencil buffer in OpenGL ES 2.0?

I'd like to write to the stencil buffer without incurring the cost of my expensive shaders. As I understand it, I write to the stencil buffer as a 'side effect' of rendering something. In this first ...
1
vote
0answers
1k views

Clipping polygons in XNA with stencil (not using spritebatch)

The problem... i'm drawing polygons, in this case boxes, and i want clip children polygons with its parent's client area. ...