Garry's Mod Wiki


  render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION enum compareFunction )


Sets the Compare Function that all pixels affected by a draw operation will have their Stencil Buffer value tested against.

When not set to a static value like NEVER or ALWAYS, the Stencil Buffer value corresponding to each affected pixel will be compared against the current Reference Value.

Pixels that Pass the Compare Function check move on to the Depth Test, which determines if the draw operation will ultimately be allowed to overwrite the pixel's Color Channel, Stencil Buffer, and Depth Buffer values.

Pixels that Fail the Compare Function check have the Fail Operation performed on their Stencil Buffer value and do not have any of their Render Target layers modified by the draw operation.

For more detailed information on the Stencil system, including usage examples, see the Stencils Render Reference page


The Compare Function that each affected pixel's Stencil Buffer value will be evaluated against during a draw operation.