The last four days were intense. The task was to speed up base model creation and fix flaws in the base model. Before optimization, creating a base model took 10 seconds or more for 50 bones. Of course, that's completely unacceptable in the modern world. So began the painstaking work of speeding up model creation. First, I got a new base model that is created in 20-50 ms for 100 bones. webgl-procedural-animal-1 At this stage the model doesn't match expectations, but it has no intersecting triangles, and it's a solid piece with no triangles inside. After testing on different models with different numbers of bones, I found and fixed every issue that caused triangles to fold. The next step was aligning the model to the bones. This is the hardest part: it's important to move the vertices correctly so the model isn't damaged and ends up as close as possible to what's expected. webgl-procedural-animal-2 Looking at the model briefly, you can see that the vertices are now distributed over the bone surfaces and have already become a prototype for the next step: splitting triangles with alignment to the bones. webgl-procedural-animal-3 The result: the model is ready. Creation time is 500 ms. Let's compare the finished model with the bones: webgl-procedural-animal-4 The image shows that the model is almost completely aligned with its bone prototype. But this is only the first stage. The second stage is automatic UV mesh creation for the model, which I'll cover separately. The optimization goal is reached, and as usual it's all done in JavaScript.