Using stencils to reveal a prop over time

Are there any tutorials for revealing a prop over time with stencils? Essentially, what I’m trying to draw a very small sliver of a PHX cone prop, then over time, draw more and more until it becomes a full cone in a circular fashion.

I’m using this to visualise volume by rotation, starting with a line and “rotating” it into a cone (really, just draw more of it over time).

If you don’t know how to, I don’t know who would

you just need to figure out a render mask that would represent the drawn solution’s screen space

so you need to map a 3d revolution to 2d space tracking what space has been rendered over already

if it is literally just a cone you want, you could render an invisible triangle in 3d space setting stencil values as it goes, a triangle wide and tall enough to fully encapsulate the object

[editline]22nd May 2016[/editline]

except this would only work while standing still looking at the object and not moving your camera… you could accomplish this better by generating a cone mesh with slow procedural rotational generation; the invisibly rendered mesh itself as the stencil render mask

[editline]22nd May 2016[/editline]

if you don’t want to use meshes, you could do the rotational triangle except do it every frame where each frame has more work to do than the one before it (rendering the triangle for many angles per frame, more for more reveal)

meshes sound like the best bet

[editline]22nd May 2016[/editline]

you can learn too!

here’s a big list of stencil tutorials i put together on an account i used some years back

How do you procedurally generate a set mesh?

you can dynamically create meshes, just not the faster-to-draw more efficient kind you bake <- baked static unmoving efficiency; you calculate the 3d points once and they don’t move; slow if you tried to use these dynamically so use the one below <- can move; just a little of this at a time won’t harm your fps at all; you recalculate these vertices every frame

you recalculate it every frame, so you can opt to either only create triangles of the 3d shape you think you need, or you could create ALL vertices at once and apply a function that sets their positions (where an incomplete rotation means the remaining vertices are all on the last completed rotational edge)

it doesn’t need to be pretty; just make it a big properly sized cone that renders invisibly
one point at the top center, another at the bottom center, the last one some distance away at the bottom height: and another set to connect the space between the triangles for the outer face so that you can only draw a few vertices and not calculate a billion; it will be blocky yet look fine because this is just an approximation for your stencil mask

[editline]22nd May 2016[/editline]

to be more specific, you just need the upper center and a series of points in a circle to generate triangles for representing the outer surface, and two triangles where the cut exists so it is still a solid shape

those are the outer

draw all of those, a few at a time rotationally, but don’t forget to also draw the triangular face inside the cone representing the two edges exposed to the world at the time (the first one and the very last one per frame)

[editline]22nd May 2016[/editline]

it may be easier to use a cylinder rather than trying to find a cone height/width that works for any shape to be fully encapsulated; the cylinder height/width would just be the item’s bounding box mins and maxs difference

[editline]22nd May 2016[/editline]

gee golly what a rambling post i’ve made

Could RenderClipPlanes help?

the default effect when spawning an item uses it, but i don’t think you could achieve a radial effect with it in the way required

Yeah, you can’t use them to make a concave shape so that wouldn’t help here.

I may be incorrect in understanding what you are trying to do here, so correct me if I’m wrong. If you are trying to display a sector of the cone growing in size (angle), then wouldn’t it be easier to just use clip planes? You would need to draw the prop twice, but it should be simple enough to understand.

I’m attempting to use clip-planes with the example on the wiki page, but it’s not doing anything (I’m aware it’s cross realming, I just ran the clientside portion on a prop in my eye trace). No matter what I set the normal or position to, the prop stays completely visible. Should I be putting this in a hook? Currently, I’m only running it once.

This is what I meant. Along with pop and push custom clip planes.
Although I may still be misunderstanding the problem.

I’m attempting to show a cone over time in a cyclic fashion. Bitches drawing describes it pretty well: starting with one “triangle” or sliver, then progressively showing more until the whole cone is there. I’m going to try meshes next if I can’t get the clip plane to work.

I did this for my senior math project, and ended up using

mesh.Begin to draw the cone with a configurable number of triangles in order to display Riemann volume/surface area approximations.