Questions tagged [stencil]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
155 views

Setting the Stencil Test Function and Stencil Operation for subsequent draw calls in Unity SRP

I'm using HDRP and I would like to extend it without actually modifying HDRP code or writting my own SRP. I'd like to: Render some objects with a custom shader Have those objects increase a stencil ...
Daniel Marques's user avatar
0 votes
0 answers
60 views

stencil as shader resourceview

I would like to use the stencil information in my depthstencil buffer as shaderresourceview (DX11) in my shader. I have a DSV D24S8 from which I create a R24X8 resource fine using the red for ...
philB's user avatar
  • 99
2 votes
1 answer
151 views

How to get rid of intersections between terrain and road strip drawn on top?

When I draw a road as is (stencil:off, depth:on,less), the results are like this - ; Then I tried adding stencil a test for the road: ...
USSRCoder's user avatar
0 votes
1 answer
98 views

I can't render faces properly in my DirectX11 project

For some reason, only back-faces are rendering, even if I set the rasterizer and stencil buffer and state to any values. Setting D3D11_CULL_NONE, ...
NicusorN5's user avatar
0 votes
0 answers
183 views

OpenGL I want my image to change color based on stencil

I have an image and a rectangle on the screen, using the using this stencil functions I managed to render or not render a certain part of my image. ...
shrain's user avatar
  • 1
1 vote
1 answer
301 views

Why does my stencil buffer allow pixels through?

I'm rendering a scene using OpenGL. The scene consists of a grassy environment and a small lake (visible as two surfaces). To achieve water surface transparency, I'm using a stencil buffer to render ...
Grimelios's user avatar
  • 549
1 vote
1 answer
805 views

Using a mesh stencil with 2D lighting in the Universal Render Pipeline

I've followed the CodeMonkey tutorial on using a dynamic mesh as a stencil for a field of view or visibility polygon effect, and have got it working using the latest version of Unity and its Universal ...
amkingTRP's user avatar
  • 188
1 vote
0 answers
357 views

Custom shader with stencil breaks Unity built-in masking

my custom shader works like a charm for what I wanted it, but if it is referenced in the scene, Unity built-in masking stops working (both the Sprite Mask component and the rect-based Mask stop ...
Jan Mysior's user avatar
0 votes
1 answer
23 views

OpenGL stencil pipe

Is there a document describing 2D stencil pipe ? Static, no rotation etc. Something in more details then enable stencil (buffer) write stencil ( mask) to stencil buffer 1st pass write stencil ...
Jan Hus's user avatar
  • 99
0 votes
1 answer
143 views

How to draw stencil ref value

hi i am currently implementing UI screen that shows Depth Complexity of scene, so that we can figure out how many time each pixels work for same pixels. for this i need to render stencil ref value. ...
KIM CHANGJUN's user avatar
1 vote
1 answer
6k views

How to hide objects behind an invisible plane?

I am using Unity 2019.1.4f1 (personal) in regular 3D mode. I want to make a material for a plane that will cause everything behind that plane to be invisible. I want a character who steps through a ...
hatinacat2000's user avatar
0 votes
2 answers
118 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.
mgs_bravo's user avatar
2 votes
0 answers
250 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 ...
Shaw's user avatar
  • 21
0 votes
1 answer
330 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 ...
manabreak's user avatar
  • 1,048
1 vote
0 answers
192 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: ...
brandoncluff's user avatar
1 vote
1 answer
323 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 ...
Harry's user avatar
  • 690
0 votes
1 answer
3k 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, ...
PaulD's user avatar
  • 791
0 votes
2 answers
4k 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 ...
user94577's user avatar
0 votes
1 answer
214 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. ...
Notbad's user avatar
  • 1,075
3 votes
1 answer
2k 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. ...
eclmist's user avatar
  • 1,153
5 votes
1 answer
4k 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: ...
eclmist's user avatar
  • 1,153
1 vote
0 answers
334 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 ...
user3412355's user avatar
1 vote
0 answers
170 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 ...
user3412355's user avatar
0 votes
1 answer
509 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 ...
user81986's user avatar
  • 173
1 vote
2 answers
650 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. ...
Yevheniy8's user avatar
-1 votes
0 answers
43 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 ...
Doodlemeat's user avatar
2 votes
1 answer
1k 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: ...
user avatar
6 votes
1 answer
3k 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 ...
Yevheniy8's user avatar
2 votes
2 answers
1k 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://...
Lehooo's user avatar
  • 21
4 votes
2 answers
7k 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 ...
tbkn23's user avatar
  • 403
1 vote
1 answer
400 views

Does glScissor affect stencil and depth buffer operations?

I know glScissor() affects glColorMask() and glDepthMask(), but does it affect the stencil ...
Arun AC's user avatar
  • 115
2 votes
1 answer
641 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 ...
Reanimation's user avatar
2 votes
1 answer
621 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 ...
khanhhh89's user avatar
  • 243
0 votes
1 answer
197 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 ...
Pacha's user avatar
  • 439
1 vote
1 answer
354 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 ...
foobar's user avatar
  • 11
7 votes
1 answer
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: ...
Brendan Wanlass's user avatar
4 votes
2 answers
628 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 ...
Nock's user avatar
  • 168
1 vote
1 answer
331 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 ...
Alex Ames's user avatar
  • 392
4 votes
1 answer
7k 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 ...
notlesh's user avatar
  • 3,867
1 vote
0 answers
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. ...
Blau's user avatar
  • 3,386