Do anyone have any idea why this is happening?
image is something like this
https://i.imgur.com/p5YPlIR.png
but when I use stencil, I get rectangle area.
this is part of example code.
draw circle is replaced to draw circle texture.
render.ClearStencil()
render.SetStencilEnable(true)
render.SetStencilWriteMask(255)
render.SetStencilTestMask(255)
render.SetStencilReferenceValue(1)
render.SetStencilFailOperation(STENCILOPERATION_KEEP)
render.SetStencilZFailOperation(STENCILOPERATION_KEEP)
render.SetStencilPassOperation(STENCILOPERATION_REPLACE)
render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_ALWAYS)
render.SetBlend(0) --don't visually draw, just stencil
surface.SetDrawColor( 0, 0, 0, 1 )
local r = radius * 2
surface.DrawRect(x - radius, y + radius - r*frac, r,r*frac)
render.SetBlend(1)
render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_EQUAL)
surface.SetDrawColor(col)
drawCircle(x,y, radius)
render.SetStencilEnable(false)
The rendering area is all the stencil cares about. That's going to be the full rectangle irrespective of which parts in it are transparent. You'll have to draw a circle out of lua polygons instead.
damn that's sucks ass
Try looking up Blue's masks and shadows on Facepunch, at least that is what I think it was called, I believe it might be useful for your problem.
I believe the function you're looking for is: render.OverrideBlend(...).
It allows you to override the graphical function for color and alpha. Even allow you to subtract a texture by its alpha.
let me try mate
Sorry, you need to Log In to post a reply to this thread.