Jump to content

Hi There

Welcome to Klub Exile. If you happened to make your way to the site either from Lovers Lab or a Search on Google, we are glad you found us.  To unlock the entire site you will need to have a account registered.  Don't worry it is free but in the mean time you can read up on why we made the site and other little tidbits.  Feel free to join or Discord Server also if you have any more questions.  Thanks for stopping by and See You on the other side.

admin admin

Any tutorial on how to crerate a custom body?


tarucco

Recommended Posts

Hi!

 

I've searched a lot on this website looking for tutorials about creating custom bodies, to no avail. Any help about it would be much appreciated!

  • Thumbs Up 1
Link to comment
Share on other sites

I've made this script to morph vanilla body into other custom body, however it requires to 3rd part software to import vanilla body (from obj) (only vertices and faces) and then it sculpts into desired custom body (not ideal but works most of the time if we are not making some weird shit). But then we have set of some faces and vertices that we need to import (obj) into blender and somehow connect armature etc to the resource trs group.

However i have no idea how to export that as a custom body.

ANy help would be apprecieated:


inline 3DMODEL * MorphInto(3DMODEL * from, 3DMODEL * to, bool toinside)
{
    3DMODEL * res = new 3DMODEL();
float max_ray_length = maxfa(from->getMaxDim(), to->getMaxDim())*1000.0;

    res->StdCopyFrom(from);
    
        for (int f=0; f < from->FaceLength; f++)
            for (int v=0; v < from->FACE_DATA[f].LENGTH; v++)
            {
                vec3 normal;
                int cnt = 0;
                vec3 na;

                int index = from->FACE_DATA[f].INDEX_START + v;
                vec3 av = from->VERTEX_BUFF[index].v;


                for (int f2=0; f2 < from->FaceLength; f2++)
                    for (int v2=0; v2 < from->FACE_DATA[f2].LENGTH; v2++)
                    {
                        int index2 = from->FACE_DATA[f2].INDEX_START + v2;
                        if (av == from->VERTEX_BUFF[index2].v)
                        {
                            na = na + from->FACE_N[f2];
                            cnt = cnt + 1;
                        }
                    }

                if (cnt > 0) //if valid normal count
                {
                    vec3 smoothed_normal = na / float ( cnt );

                    vec3 vA = av;
                    vec3 vB = vA + smoothed_normal*max_ray_length;

                    vec3 hit_result1 = vec3(999999.9);
                    int f_res1;
                    vec3 hit_result2 = vec3(999999.9);
                    int f_res2;

                    bool found = false;

                    if ( RayIntersectsModelClosest(to, vA, vA + smoothed_normal*max_ray_length, hit_result1, f_res1) )
                        found = true;
                    if ( RayIntersectsModelClosest(to, vA, vA - smoothed_normal*max_ray_length, hit_result2, f_res2) )
                        found = true;

                    if (found)
                    {
                        float d1 = VectorLength(vectorAB(vA, hit_result1));
                        float d2 = VectorLength(vectorAB(vA, hit_result2));
                        bool positive_closer = (d1 >= d2);
                        if (positive_closer)
                        from->VERTEX_BUFF[index].v = hit_result1;
                        else
                        from->VERTEX_BUFF[index].v = hit_result2;

                    }

                }

            }






    return res;
}

 

  • Love It 1
  • Thumbs Up 1
Link to comment
Share on other sites

27 minutes ago, thedude said:

I've made this script to morph vanilla body into other custom body, however it requires to 3rd part software to import vanilla body (from obj) (only vertices and faces) and then it sculpts into desired custom body (not ideal but works most of the time if we are not making some weird shit). But then we have set of some faces and vertices that we need to import (obj) into blender and somehow connect armature etc to the resource trs group.

However i have no idea how to export that as a custom body.

ANy help would be apprecieated:


inline 3DMODEL * MorphInto(3DMODEL * from, 3DMODEL * to, bool toinside)
{
    3DMODEL * res = new 3DMODEL();
float max_ray_length = maxfa(from->getMaxDim(), to->getMaxDim())*1000.0;

    res->StdCopyFrom(from);
    
        for (int f=0; f < from->FaceLength; f++)
            for (int v=0; v < from->FACE_DATA[f].LENGTH; v++)
            {
                vec3 normal;
                int cnt = 0;
                vec3 na;

                int index = from->FACE_DATA[f].INDEX_START + v;
                vec3 av = from->VERTEX_BUFF[index].v;


                for (int f2=0; f2 < from->FaceLength; f2++)
                    for (int v2=0; v2 < from->FACE_DATA[f2].LENGTH; v2++)
                    {
                        int index2 = from->FACE_DATA[f2].INDEX_START + v2;
                        if (av == from->VERTEX_BUFF[index2].v)
                        {
                            na = na + from->FACE_N[f2];
                            cnt = cnt + 1;
                        }
                    }

                if (cnt > 0) //if valid normal count
                {
                    vec3 smoothed_normal = na / float ( cnt );

                    vec3 vA = av;
                    vec3 vB = vA + smoothed_normal*max_ray_length;

                    vec3 hit_result1 = vec3(999999.9);
                    int f_res1;
                    vec3 hit_result2 = vec3(999999.9);
                    int f_res2;

                    bool found = false;

                    if ( RayIntersectsModelClosest(to, vA, vA + smoothed_normal*max_ray_length, hit_result1, f_res1) )
                        found = true;
                    if ( RayIntersectsModelClosest(to, vA, vA - smoothed_normal*max_ray_length, hit_result2, f_res2) )
                        found = true;

                    if (found)
                    {
                        float d1 = VectorLength(vectorAB(vA, hit_result1));
                        float d2 = VectorLength(vectorAB(vA, hit_result2));
                        bool positive_closer = (d1 >= d2);
                        if (positive_closer)
                        from->VERTEX_BUFF[index].v = hit_result1;
                        else
                        from->VERTEX_BUFF[index].v = hit_result2;

                    }

                }

            }






    return res;
}

 

Hello thedude, i'm really really interest by your script because it can morph (if %) models with differents vertex number with Ray_intersection.

But i'm noob and i not understand where it must be use, i Don't Distinguishes blender script convention ?

  • Thumbs Up 1
Link to comment
Share on other sites

There are blender plugins to import bodies, search for klubadept or weather plugin.

Or this if you are really into development.

 

  • Thanks 1
Link to comment
Share on other sites

Hello tarucco, i show you up, some tools for body edition. But if you just begin with mod, best to first make toys to learning the base. Because body_objects need weight and bones, more complex than toys. You can see in download section what it is possible to do with toys...

  • Thanks 1
Link to comment
Share on other sites

  • Administrator

Use above hfg2's custom plugin for best results - but also requires largest extent of work. However, the armature can be changed with it.

If you want to modify only existing vanilla body without altering the number of vertices, use basic export-import plugins.

There is one specific Blender plugin that I use for longer time now, and that enables very easy conversion of majority (90 % approx, but depends) of morphs from one body, to another body with completely different topology. To understand topology in one image for those who wonder about it

8319a0ee-ff3a-46dd-aa21-f65c2a22b6ac.png

Simple example of almost exactly the same shape, yet drastically different topology. 

The Blender plugin I use https://mmemoli.gumroad.com/l/tOKEh?layout=profile (its free, but also donation based for who wants to donate)

Technically, will work on many areas, but intention is mainly on body itself, without feet, hands and without open mouth poses on head. VERY easy to convert whole batches of morphs from one body to another, in just few clicks.

The hands and feet should in general have their own topology. Some fairly basic morphs could work also one them, but from my experience, its easier and more precise to make them from scratch. Otherwise, if having converted hands and feet from some other place that already has morphs, majority should work and be convertible into Blender.

Two things to always have in mind - 1. Armature should always be used to pose limbs and extremities, morphs should never try to do what armature does, because vertices always follow the shortest path 2. Use morphs to fine tune the "surface", some basic deformations, expressions etc. But never use them for like, rotating or moving hands, legs or fingers...

  • Thanks 1
Link to comment
Share on other sites

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

WARNING! Adult Only Content You must be 18 years of age or older to enter. By accepting you agree to Klub Exile's Terms of Use and Guidelines upon creating an account.