Browse Source

Correct depth testing for setStencilWrite

mcc 2 years ago
parent
commit
374db2f37d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      examples/Effects/Stencil/main.lua

+ 2 - 2
examples/Effects/Stencil/main.lua

@@ -134,8 +134,8 @@ function scene.draw(pass)
 	for _, cube in ipairs(scene.stencilCubes) do
 		local center, stencilValue = unpack(cube)
 
-		-- Draw to stencil
-		pass:setStencilWrite("replace", stencilValue)
+		-- Draw to stencil (but only when we pass the depth test)
+		pass:setStencilWrite({"keep", "keep", "replace"}, stencilValue)
 		pass:cube(center*scene.stencilCubeSize, scene.stencilCubeSize)
 
 	end