0
\$\begingroup\$

I am working on a mobile game, in which I am tiling a cylindrical mesh along a dynamic spline. The points of the spline are changing each frame, so the vertex positions and normals of the tiled mesh are completely dynamic.

Right now I am using a plugin that does all the vertex computing and mesh generation in C#, and therefore the CPU. This proved useful for static splines that don't change, however gives a very poor performance for the dynamic splines I am working with that change each frame.

For a more performant solution, I am thinking of writing a geometry shader or a compute shader that generates the mesh by calculating all the vertices. Each frame, I will pass the current set of points along the spline to the shader, and it will generate a cylindrical mesh extruded from the given spline on the fly.

Would this approach yield a satisfactory performance on mobile? Is there another approach that would be more performant?

\$\endgroup\$
2
  • \$\begingroup\$ 1. How many splines do you need? Is it reasonable to assume that there are fixed number of splines with fixed number of control points? 2. Following 1 - won't static mesh + skinning work? Is fully fynamic spline really necessary? (webglfundamentals.org/webgl/lessons/webgl-skinning.html) \$\endgroup\$
    – Tooster
    Aug 22, 2021 at 21:55
  • \$\begingroup\$ @Tooster 1. Number will be dynamic as well, it will grow and shrink during gameplay. 2. We thought about it actually but I honestly could not wrap my head around that option. The dynamic mesh will be a snake's tail and it needs to follow head's path exactly. Therefore I am keeping a buffer of head's previous positions and build a spline from that. Then snake's body parts simply sample along that spline based on their desired distance to head. \$\endgroup\$ Aug 23, 2021 at 6:27

0

You must log in to answer this question.

Browse other questions tagged .