- Home /
how to progressive rendering a mesh?
Hi guys,
I have a bezier curve on which I draw a mesh. I want to render it progressively. You can see the final result on this video: https://youtu.be/J8oyxfL5IeU
For achieve this result I build the mesh vertex dynamically but I think that this isn't the best method. Is there a better way to do this without rebuild the mesh? For example using a shader or uv map? Unfortunately I am not practical of this subjects.
Answer by Bunny83 · Oct 17, 2018 at 11:31 AM
Well progressively based on what?
If it should appear based on "time" you can give each vertex a time value when it should be visible. Inside a shader you can use the _Time.y value inside the fragment shader to selectively show parts of the curve. The nice thing is that vertex parameters are interpolated across the triangles so you get an actual cut off line in between.
If it shouldn't be based on time but another provided value it would work the same way, just use your own shader parameter which you can adjust from a script the way you like.
Note using time directly may not give nice results if the time grows too large the precision drops. So using your own "time" which you.
If your mesh does not use uv coordinates you could use those to encode your "time" value. Otherwise you can use any other value like color, uv2, ... Keep in mind that most vertex values are actually float4 even only 2 are used most of the time.
No, not really since your question is too abstract. However i've posted an example how such fading can be achieved back then over here. The unitypackage which includes the shader and the example scene can be found in the link below my webgl example.
You probably don't need the fading bit, just a cut off. Ins$$anonymous$$d of transparency you can just use clip / discard in the shader. Writing custom shaders is not that hard but you should get familiar with how shaders and the graphics pipeline works. Note that Untiy Answers is not a place to request other people to do your work for you. We don't get paid for our work here.
Your answer
Follow this Question
Related Questions
Combining Mesh's For Mesh Deformation 1 Answer
Objects Appear in the wrong place when built 1 Answer
Cylinder Variance 0 Answers
Lost Lightmap in Mesh Renderer 0 Answers
how to set the uv of the texture(or mesh renderer) 2 Answers