Jump to content

Automatic Joints with Mesh Generation in Unigine


photo

Recommended Posts

Posted (edited)

Good day,

I created a prototype program in Unity which allows me to create joints with localAxis (x,y,z) and move them by hierarchy using Quaternions: https://github.com/Sevdat/UnityVerticesAI

image.thumb.jpeg.b30a2af77fee47a293863347dffd937c.jpeg

The picture you see above is how the program works. We only need to know the Radius and which index the current index is connected to. We generate the joints as a line going down to align all the local axis for the joints, reduce file size for compression purposes, and than expand the body from a vertical line down to the Humanoid form. This way we can generate any skeleton structure.

The new version I am working on will use an octtree for sphere collisions for each joint and allow us to generate vertexes for the triangles. This way we can generate joints with meshes in unigine. I've made some calculations and rounded the overall bit usage of each Joint (Atom) will consume near to 300 bits. In the example above, we have 42 joints and if we assume that each joint has around 100 Atoms for the triangles to be drawn on then 300*42*100 = 1260000 bits which is 0.1575 megabytes for each body. 

The current struct logic looks like this (without octree. Still figuring it out, but noticed that unigine is already optimized in collision detection so integrating that would be better.)

    public Node clone;
    public World world = new();

    public class World {
        public int atomsInWorld,maxAtomsInWorld;
        public BodiesInWorld bodiesInWorld = new();

        public struct Atom { 
            public int bodyStructureKey;
            public int atomicMeshKey;
            public float radius;
            public vec3 position;
            public Color color;
        }
        public struct Axis {
            public vec3 origin,x,y,z;
        }

        public class BodiesInWorld {
            public Dictionary<string,BodyData> allBodies;
            public struct BodyData {
                public string name; 
                public Axis globalAxis;
                public Dictionary<int,JointStructure> bodyStructure;
            }
            public struct JointStructure {
                public List<int> connectedToJointIndex;
                public Axis localAxis;
                public Dictionary<int,Atom> atomicMesh;
            }
        }
    }

Currently it's not connected to a neural network, but if in the future we do, then we can give instructions to an LLM to automatically generate bodies for us in the Editor. I would like to know your ideas and suggestions. Does this already exist?

P.S I couldn't upload the zip file with the Gifs, so I'll add the github link where the prototype version is and add the gifs there: https://github.com/Sevdat/UnityVerticesAI/tree/main/Version4

Edited by Sevdat
×
×
  • Create New...