animate1978 / MB-Lab

MB-Lab is a character creation tool for Blender 4.0 and above, based off ManuelBastioniLAB
Other
1.84k stars 314 forks source link

Morphs creation (Copy/Move/Delete/Rename/Backup morphs tool done) #226

Open TetoTheSquirrelFox opened 4 years ago

TetoTheSquirrelFox commented 4 years ago

So, I try to help by making tools to create like morphs (or muscle if I can figure how it works).

But I had to answer few questions first :

So what I think about that:

You can see the content in characters_config here: "f_no01": { "description": "Generate a base female character for creating morphs", "template_model": "MBLab_human_female", "name": "f_no01", "label": "Base female (F_NO01) (AGPL3)", ... "texture_sclera_mask" : "sclera_mask.png", "morphs_extra_file": "", "shared_morphs_file": "", "shared_morphs_extra_file": "", "bounding_boxes_file": "human_female_bbox.json", ... "vertexgroup_base_file": "human_female_vgroups_base.json", "vertexgroup_muscle_file": "human_female_vgroups_muscles.json" }

Problem is that some morphs could be very specific to a race or a phenotype, and could not work properly in all models for a reason. So I decided that user could use the model he wants, and create his own morphs while other morphs are already used. To assure that, I put the “morphs editor” in the Pre-Finalized State session (gui_status == "ACTIVE_SESSION") and put it between “random generator” and “measures”. So, for the user who chooses “F_NO01” he can create, and for the others he can use other morphs as well.

So, as MB_Lab is not designed to create bodies from scratch, but more to use what it is available, I tried to be as simple as possible, while let the user to have the most useful tool to create new morphs.

So now here are the problems I’m facing :

At first, the tool would have looked like this (on the panel):

But, first I wanted to have my own models, copies of the ones used by the engine, but after a while I started to think that it was not good. The engine is complex, and I should keep a coherence with it. The model the user is working on is linked to the engine, so let’s keep it that way. And the engine has already many useful tools like reset, loading, saving… So, if the user wants making morphs from base model, no problem, he can use the “reset character” button. If he wants to create while character already has morphs applied, he can use ‘import/export character”.

So now the tool looks like this :

The workflow would look like this :

I’m working on it now, and if you agree, I’d like to make a morph.py dedicated for this, so the changes in other .py files would be minimal. I’d like to talk about the work in progress here too.

TetoTheSquirrelFox commented 4 years ago

So, as I'm starting to think about my new tool, I was thinking also about my combined morph tool, that I didn't tested yet, especially because I'll need it for the new tool anyway.

So I started to test it and I did 2 very fast morphs to see what's going on when we combine them and how the engine handles them.

So first, I did my 2 morphs, one overlapping the other, of course, and did stupid shape but that's the point : see how it works. I did a pike and a bump with the morph tool, and saved them under a special file, f_af01_morphs_temp.json, because I'll combine them and after that I won't need them in their original form (separated morphs). Morphs under Body. image Bump maxi image Pick maxi. Don't show the combinations and min values (it's the same, but inside the body) So, quit Blender, reopen it, and voilà, the morphs are available, and show the same thing as I sculpted before. image

Now the juicy part. I open the combined morph tool. Choose to combine 2 morphs, use my pseudo for the name. image Then, without touching the morphs, but just doing combinations min/max (so 4 combination in total), I finalize the file. Quit Blender, delete temp file, just keep teto file. Open Blender, create an African female. First good new : the combined morphs are shown as separated : image After that I played with cursors and... nothing spectacular

So I don't think that the advantages of combined morphs are here. Tomorrow, I'll remake the combined file, but this time I'll sculpt combinations before saving, to see what's going on. I think that the interest of combined morph is here : to add extra details that are impossible to have when the morphs are separated. But I'll check that tomorrow. Below the 2 json files if you want to play with them. Careful : change af01 to af02 or move the file elsewhere if you don't want to use them both in the same time. Because the engine add the vectors of the same name, combined or not... Interesting behavior by the way.

morphs.zip

TetoTheSquirrelFox commented 4 years ago

So I did other tests tonight, and I think I nailed the thing.

What I did basically. I put the file "temp" with my 2 simple morphs (that overlap each over), then I took "min" for bump and "max" for pike : 001 Then I sculpted the 2 a little to have this : 002 Saved the morphs file, quit Blender and reopen it after deleting "temp" file. Tried "Pick" and "Bump" in "Body", with min and max, aaaand what I sculpted shows again, as intended. Of course, if I have "Bump" in 0.5 (aka the neutral value) and Pike at max, the result is slightly different from the first test where morphs were separated : image The first morph was way more sharp, but it's normal, as the engine doesn't have the first separated 2 morphs no more. So, for me, and maybe I'm wrong, but as far I investigated in order to make the tool, here how it works :

animate1978 commented 4 years ago

The complexity is growing... not a bad thing, just something to note for myself.

TetoTheSquirrelFox commented 4 years ago

I'm tired, and the tool(s) is not finished yet (@animate1978 , I pushed the commit to save files, just in case, but please wait until it's done), but here is a teaser : image

What's this ? If the addon is a success, and morphs grow, there will be a time where you'll have dozens of morph files dedicated for one model available, and sometimes user will have to manage them. Make compilations, delete some morphs, move others, and so on. So the tool is made for these operations, copy, move, delete, rename and even make backups (with date). You can do all of that from a source to a destination, create new files if needed...

My only issue for now is :

TetoTheSquirrelFox commented 4 years ago

Quick update : This evening I did bugfixes (there were a lot!) and improvements in the code, simplification and so on. Now the end is near, the tools should be finished tomorrow (should...).

Anyway, @animate1978 , here is something that is relevant to be in documentation I think. Where exactly ? I don't know. In "known issues" maybe ? (below the separation)

About the use of drop-down lists:

Where is the problem ?

animate1978 commented 4 years ago

This is great!

I did manage to get some warnings from Blender, doing what you described above. I was trying to do it purpose to see what would happen. There is a difference between Blender 2.82 and 2.83 (alpha builds)... there is a lot more information being printed to the terminal output in 2.83, not sure why and honestly I like that because it gives a little more feedback like during creation of a character, in 2.83 there term output prints this ...

... Morph Nose_NostrilSizeX_max duplicated while loading morphs from file Morph Eyebrows_Ridge_max duplicated while loading morphs from file Morph Eyebrows_Angle_max duplicated while loading morphs from file Morph Chin_Tone_max duplicated while loading morphs from file Morph Nose_NostrilDiam_min duplicated while loading morphs from file Morph Head_Flat_min duplicated while loading morphs from file Morph Chin_SizeZ_min duplicated while loading morphs from file Morph Nose_BasePosZ_max duplicated while loading morphs from file Morph Cheeks_ZygomPosZ_max duplicated while loading morphs from file Morph Nose_WingBump_min duplicated while loading morphs from file Morph Chin_SizeZ_max duplicated while loading morphs from file Morph Jaw_Angle2_max duplicated while loading morphs from file Morph Eyebrows_PosZ_min duplicated while loading morphs from file ...

Not sure if the duplication is intended. I think I have seen this before when creating the Anime characters. Anyways I will be working on the docs for these tools very soon since you seem to be close to completing these.

TetoTheSquirrelFox commented 4 years ago

Nope, it's not that. I figured that weeks ago, don't worry. When the engine loads morphs, it loads many files where the morphs are. But if the same morph is in more than one file, it writes that. They are just warnings, the engines accepts them anyway, and replaces the old one by the new one. And typically, the anime model was clearly not finished, because many morphs are duplicated for a reason.

TetoTheSquirrelFox commented 4 years ago

The Copy/Move/Delete/Rename/Backup morphs tool is done. I tested it, it looks functional and I didn't see bugs (I mean, after I fixed them ^^ )

@animate1978 and @everyone don't hesitate to test it (make backups before !) and tell me if there are bugs or things you don't like or should be improved.

image

I won't explain again how it works, the GUI didn't change much since my last explanations. But there's an addendum :

Tool limitations

Warnings