Skip to content

SetEntityStencilBack

Narta Xaymar Dirks edited this page Nov 25, 2026 · 1 revision

SetEntityStencilBack

SetEntityStencilBack:Void entity:Int32, compare:Int32, fail:Int32=0, depth_fail:Int32=0, pass:Int32=0
Parameter Mode Type Default Description
entity In Int32 required Entity handle.
compare In Int32 required The comparison, from 0 to 7.
fail In Int32 0 The operation when the comparison fails, from 0 to 7. Default 0 (keep).
depth_fail In Int32 0 The operation when the comparison holds and the depth test fails, from 0 to 7. Default 0 (keep).
pass In Int32 0 The operation when both hold, from 0 to 7. Default 0 (keep).

Description

Sets the stencil test and the operations for the back faces of an entity, the triangles that face away from the camera. Back faces are only drawn when the entity shows both sides (EntityFX 16). Call it after SetEntityStencil, which sets both sides to the same; the reference and the masks of that stay the same for both. This is a BlitzLLVM extension.

The numbers of the comparison and the operations are the ones of SetEntityStencil. A common use is a shadow volume in one draw: the front faces increment where the depth test fails and the back faces decrement there.

Examples

Graphics3D 640, 480, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()
SetCameraStencil camera, True
volume = CreateCube()
EntityFX volume, 16
EntityAlpha volume, 0.01
; Front faces count up, back faces count down where the volume is behind something.
SetEntityStencil volume, 7, 0, 255, 255, 0, 6, 0
SetEntityStencilBack volume, 7, 0, 7, 0
RenderWorld
Flip
WaitKey

Related Commands

CopyEntity, EntityAlpha, EntityAutoFade, EntityBlend, EntityClass, EntityColor, EntityDepthFade 〔BlitzLLVM〕, SetEntityStencil

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

More

Clone this wiki locally