Hi :D
can i cut a rect to a circle
when i use
render.RenderView
i made a minimap with render.Renderview but i want it as a circle not a rect
how can i do this?
It's possible using stencils, but I'm too stupid to know how those work, so I can't really explain them here :/
Here's a tutorial on stencils:
[url]https://facepunch.com/showthread.php?t=1337232&p=43271812#post43271812[/url]
If you can understand that, then you know that all you need to do is invisibly draw a circle as the render mask: [url]https://wiki.garrysmod.com/page/surface/DrawPoly[/url]
[editline]29th August 2016[/editline]
(by this means you can hide the part of the rectangular minimap that is outside of a circular region on screen)
you might also want to remove the 3D2D lines from the examples and also change the hook from PostDrawOpaqueRenderables to HUDPaint
yeah i know that i use stencil, but i cant understand it
where i put the render.Renderview :(
If you are having problems with render view, oh boy, you're too fresh to start with stencils :v
my render.renderview works
(minimap)
but i dont know how to add the stencil on render.renderview
nothing happen when i put it between the code :(
maybe because it is no draw. ... function?
[editline]30th August 2016[/editline]
the tutorials i currently found are not helping :(
[editline]30th August 2016[/editline]
[code]
local win = {}
win.w = 300
win.h = 300
local CamData = {}
CamData.angles = Angle(90,LocalPlayer():EyeAngles().yaw,0)
CamData.origin = LocalPlayer():GetPos()+Vector(0,0,8000)
CamData.x = (ScrW()/2)-(win.w/2)
CamData.y = ScrH()-(win.h/2)
CamData.viewmodelfov = 90
CamData.w = 300
CamData.h = 300
CamData.ortho = true
CamData.ortholeft = -2000
CamData.orthoright = 2000
CamData.orthotop = -2000
CamData.orthobottom = 2000
render.ClearStencil()
render.SetStencilEnable(true)
render.SetStencilWriteMask(255)
render.SetStencilTestMask(255)
render.SetStencilReferenceValue(15)
render.SetStencilFailOperation(STENCILOPERATION_KEEP)
render.SetStencilZFailOperation(STENCILOPERATION_KEEP)
render.SetStencilPassOperation(STENCILOPERATION_REPLACE)
render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_ALWAYS)
draw.RoundedBox(0,(ScrW()/2)-100,ScrH()-100,200,200,Color(255,255,255))
render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_EQUAL)
draw.RoundedBox(0,(ScrW()/2)-200,ScrH()-200,400,200,Color(0,0,0))
render.RenderView( CamData )
render.SetStencilEnable(false)
[/code]
[editline]30th August 2016[/editline]
this works only for draw.Roundedbox not render.renderview() :(
what is my mistake?
ok it only works with draw or surface but not with render.renderview() right?
Sorry, you need to Log In to post a reply to this thread.