• First Stencil Failure
    2 replies, posted
So I finally thought I understood stencils and tried making a function myself. It's supposed to draw props behind walls but not in front of them. Can anyone tell me what I did wrong? [CODE]hook.Add("PostDrawOpaqueRenderables", "test", function() for k, v in pairs(ents.FindByClass("prop_physics")) do render.ClearStencil() render.SetStencilEnable(true) render.SetStencilWriteMask(255) render.SetStencilTestMask(255) render.SetStencilReferenceValue(100) render.SetStencilFailOperation(STENCILOPERATION_REPLACE) render.SetStencilZFailOperation(STENCILOPERATION_REPLACE) render.SetStencilPassOperation(STENCILOPERATION_ZERO) render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_EQUAL) v:DrawModel() render.SetStencilEnable(false) end end)[/CODE]
[QUOTE=Tsujimoto18;52652908]So I finally thought I understood stencils and tried making a function myself. It's supposed to draw props behind walls but not in front of them. Can anyone tell me what I did wrong? [CODE]hook.Add("PostDrawOpaqueRenderables", "test", function() for k, v in pairs(ents.FindByClass("prop_physics")) do render.ClearStencil() render.SetStencilEnable(true) render.SetStencilWriteMask(255) render.SetStencilTestMask(255) render.SetStencilReferenceValue(100) render.SetStencilFailOperation(STENCILOPERATION_REPLACE) render.SetStencilZFailOperation(STENCILOPERATION_REPLACE) render.SetStencilPassOperation(STENCILOPERATION_ZERO) render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_EQUAL) v:DrawModel() render.SetStencilEnable(false) end end)[/CODE][/QUOTE] [url]https://facepunch.com/showthread.php?t=1461027&p=47541576&viewfull=1#post47541576[/url] if you need any explaining about parts of that code, just ask here.
thank you
Sorry, you need to Log In to post a reply to this thread.