Parametric modeling from primitives (cube, sphere...) and animation

What do you think about parametric modeling? I made a class mglGeometryGenerator it assembles one geometry from primitives. Functions makeCube, makeSphere, makeRing, makeCylinder. They were written for me by deepseek (lol). They create an array of vertices, normals, UVS and indices.

The second class mglModelGenerator creates a model from geometries by adding a material.

Ah, the crux of the problem. Creating a sea mine model in Blender consisting of a sphere, a ring and 18 * 3 cylinders, I found that the glb model takes up 600 kb!
Seriously? This is not optimal. What about creating a model in the engine?
And here I did it. Absolutely the same mine as in blender ToDo: sea mine

I think it’s worth adding InstancedMesh for repeating parts.

Great, it works. But what about animation? I tried VectorKeyframeTrack, but what about something more?
Let there be mglAnimation!

I did rotation, scaling, blink: ToDo: sea mine - animate

Are there other animation options and effects that I can use?
Suggest a vertex shader with flying triangles for an explosion effect.

I also want to add a fire effect https://codepen.io/mjurczyk/pen/OJXrqjK

I think creating models in the engine is an interesting way to save traffic and fully control the assembly and animation of the model.

5 Likes

A 3D model could be done in many ways and it is important to know the advantages and disadvantages of different approaches. Sometimes Blender is the way to go, other times it is better to be avoided.

As a procedural generation aficionado I use on-the-fly 3D generation in quite many projects, like 3D assets, Platons and Mannequin to name a few. And almost always I prefer procedural generation. Only in special cases I use external modelling software. For example, weight painting, uv unwrapping, texture baking and 3D sculpturing are hard to do in code.

9 Likes

I myself am only interested in functional parametric modeling of shapes. I’ve only looked at Blender to see what it can do. I have absolutely no mastery of it and don’t use it.

Maybe you can take something from my shapes. Some are animated.

Addon. Produces almost infinite many time-varying geometries with functions
Addon to create special / extended geometries
Addon for triangulation of implicit surfaces/ forms with holes
Showrooms easy to generate from data of a construction drawing or dimensional sketch - now on Github
Curved2Geometry - a twofold curved geometry
Multi Form Geometry
Single-branched geometry organically shaped in the web editor
See also
sandbox
hofk (Klaus Hoffmeister) · GitHub

4 Likes