MB-Lab icon indicating copy to clipboard operation
MB-Lab copied to clipboard

The "data" case.

Open TetoTheSquirrelFox opened this issue 3 years ago • 9 comments

So short story : I've coded a bunch of tools related to the shape of a model, in order to change/edit things like morphs. I also coded many tools to create new models, and everything needed for the creator to be compatible with the engine.

But, there is a big problem that I never solved, too busy with the tools to create a model from scratch (you don't need the engine for this task) : to avoid confusion and problems with every project done by different creators, I decided and proposed to have a special folder for the project :

  • Actually, all data are under /data/
  • I proposed to have /toon/ or /my_project/ for new stuff created (here the projects would be toon and my_project). Great, but I faced a problem that can't be solved easily, because it's sooo hard-coded in the engine that I'm not keen of changing this : everywhere in the code the engine uses file_ops.get_data_path() pretty much for everything. So I was stuck. I don't want to touch it to avoid bugs, but because of that, I can't tell to the engine where pick-up the library.blend or the config.json for example. I did a trick for config.json, but for the blend it's impossible to change easily. I tried to find a solution and the only one I found is explained below. But I want to be sure that is OK before coding.

The solution :

This solution avoids many problem like to heavily change the actual engine, that could be source of future problems.

  • When you start a session you can choose a model, then you create you character, before changing its template/phenotype/shape/skin/... with dedicated tools. image
  • I propose to add a 2nd drop down list above this, that allows you to choose the "project" you want to work on. This list would be created automatically (the functions for that already exist), and basically the named showed would be the name of the project or the author if he has a big ego. We would have "MB-Lab base", "Toon", and so on.
  • I just touch, in file_ops, to 1 function : get_data_path(). This function, instead of always using "data" uses instead the value of the new drop-down list. I'm not sure yet, but I think it's easy to do, as you create the character (and init the engine) after the choice of the template, so I think it's OK.
  • This means 2 things :
  1. at the end, every blend under /data/ or /toon/ must be renamed humanoid_library.blend
  2. For config files, you can have more than one by project (useful when a creator wants to use a model made by someone else), it just has to be named xxx_config.json, xxx being the name of the project. The code is already changed to accept every config file put in the folder.

This way the problem is solved :

  • You can have all projects you want, as you choose it since the very beginning (and when the character is created, you don't change the model anymore).
  • Each project is clearly separated, so after the initialization of the character, you can't use files from other projects, and it's good.
  • The only con I see for now is when a creator wants to add morphs (for example) for another project :
  1. He makes a package with his morphs (like f_af01_morphs_pseudo.json ) for MB-Lab models. He doesn't have to create a special config.json for that, as the morphs files are loaded automatically. But :
  2. The user who wants to use it will have to add this to his actual /data/. So if he adds other and other files from another creators, it may becomes a mess after a while. But don't forget that the author will add his pseudo in the name of the files, as he can do for files that can be shared (like morphs).

So if it's OK I can try something next week.

TetoTheSquirrelFox avatar Jul 12 '20 14:07 TetoTheSquirrelFox

Yes I believe that would be ok.

I think it would help with the project, keeping things separate?

animate1978 avatar Jul 12 '20 15:07 animate1978

Yes, I do think so because :

  • You are very dependent of your base model that you're using (as an user). So, be sure that you whatever_morphs.json is for /toon/ and not for /data/ could help you to manage your data.
  • I do think that this addon may be used by many many people, users and creators. Having everything separated is a good start to help managing the database.
  • A model is attached to everything that is related to itself and only to itself. And things done for a model can't be used for another, in anyway.

TetoTheSquirrelFox avatar Jul 12 '20 19:07 TetoTheSquirrelFox

Teaser : image

I named this "Project" but if you want something else, no problem.

TetoTheSquirrelFox avatar Jul 13 '20 09:07 TetoTheSquirrelFox

Project seems to work just fine really.

Looks good.

animate1978 avatar Jul 13 '20 11:07 animate1978

Yes, and I just finished it, so here is the related documentation. @animate1978 : This is general documentation, the different steps for an user to sculpt the model, before finalization (as after finalization, stuff like skin, shaders, hair and so on have nothing related to the shape). I don't know where you can put it, but I think that is an important point to understand as an user and a creator, to know the mechanisms of the engine.

I did not tested extensively this. But what I did is to make a duplicate of all /data/ folder, renamed it /test/ and also renamed all models like m_ca01 as m_ca99 to be able to see differences while using the addon.

Let's go.

The steps to create a character

The user needs to go through different steps in order to create the character he wants. They're needed to choose gender, ethnic group, age, mass, body measures and so on. Sometimes, you can't go back after a step. All these steps are done before finalization, an important step where user freezes the body shape of the character. After this point, the only things the user can do are changing shaders, adding hair, add clothes...

Step 1

The user has to choose the project he wants to work with. Each project has its own models, shaders, morphs and so on. The meshes are dedicated to their project, as the rest of the stuff. For example, the models available in standard with this addon are 2 human models, a male and a female, and 2 anime (Japanese style) models, a male and a female.

So, when an user launches the addon, he has this : image

The only elements useful here are the drop-down lists "Project" and "Select" So the first is the Project. Here we have 4 projects available : image MB_Lab is the project by default, available with the addon. The others, as you can see are just examples.

We choose the default one, MB-Lab. Now we select the general type of the character.

Step 2

Now user chooses the general ethnic group of the character, the group could be Caucasian or Elf for example. Here are the groups available by default : image

The titles are self-explanatory. The user picks one then press "create character" button, then it's step 3. image

Step 3

When it's done, the user can't change the project, the ethnic group or the gender anymore. He just can change its shape. Another GUI is shown, and all operations before finalizing the character are done here. image

Many tools have their dedicated documentation, we just show here the main tools to change the shape.

  1. You have 3 categories that allow to change the general shape in one operation : the age, the mass and the tone. image
  2. Under this you have tools that setup the character. image We will explain the "character library" tool, as it is the main tool to shape the character (see step 4).
  3. Then below you have 3 tools about character design : image In step 5 we will explain the "Body measures" as it's the 2nd main tool that shapes the character.

For detailed explanation about these tools and the others, see dedicated documentation.

Step 4

When you're using "character library" you have this GUI : image

  • Types : Basically they are presets of the model. Hero, common, athletic and so on. It's a 'finished' character that can be used as a base, a quick start if you want. I need a skinny character, let's start with skinny01.
  • Phenotype : Self explanatory. If I need a black African, I can choose African, Afro-Asian and so on. The difference between these topics is that "Phenotype" gives you a base model to morph with, as "Type" is already a morphed model (but without specific phenotype). These 2 topics can be changed during morphing. Then, when the general shape of your character is done, you can morph specific parts (next step)

Step 5

It's when you're using "Body measures" : image

(Note : You can do step 4 and step 5 in the same time, the GUI allows that)

It's where the final shape can be done. You have a drop-down list to select the general part (legs, mouth, torso, ...) then the specific parts. For more explanations of the features, please go to dedicated documentation.

After finalization of the character, these steps are not available anymore. But you can save your character before finalization ; this way you can change it without problem.

So these are the 5 steps to go from a general model to your very specific character.

From a creator point of view

As a creator you have to know few more things, about the way you have to make your own models, in order to be compatible with the engine.

  1. A project can have the number of base model you want. MB-Lab has 4 models (human male/female, anime male/female).
  2. All models for a project must be in a single blend, named "humanoid_library.blend". The name can't be changed. It's this model that has also the skeleton. It can have elements that are common to all models, like teeth.
  3. Each model has a finite number of vertices. The morphing tools change their position, NEVER their number.

So the files that handle the vertices are different, and depending to the steps (see above) of the character's modeling.

  1. Model is a general shape, without the necessity to be correct. It's just to have the vertices somewhere. For example, the base human models in MB-Lab are Caucasian.
  2. Sub-models are sculptures of the type (Caucasian, Asian, ...), in the most neutral shape possible. The location of the vertices are stored in a dedicated file (not in the blend) in absolute.
  3. The phenotype (North European for example) is a general morphing of the sub-model, done with morphing tools (see below). It's a refined shape of the sub-model. The location of the vertices is relative (to sub-model) and stored in a dedicated file.
  4. Then the last step for shaping the character is the direct use of the morphs.

Note : That means that morphs can be used 3 times in the process, but only one time by the final user. 1 for the sub-model, eventually (but the model can be sculpted by other means), 1 for the phenotype, and 1 by the final user. For the morphs dedicated to the facial expressions, you even have 1 more, for creating expressions available after finalization.

About the config file :

  • You can have more than one config file, but it must finish with "_config.json".
  • That means that a creator can make his own sub-models from models created by someone else (if it's allowed of course) and creates his own package that must be added to the same directory of the base models. image

The creator has all needed tools for these steps, see dedicated documentation.

TetoTheSquirrelFox avatar Jul 13 '20 15:07 TetoTheSquirrelFox

Excellent!

I will be adding this to the docs soon as well. Just let me know when you have pushed your work to your repository and I will merge it in.

animate1978 avatar Jul 13 '20 15:07 animate1978

No problem. As you can see, I added other stuff here. (wanted to save after a while). When I put the code in repository, that means that the documentation is done.

TetoTheSquirrelFox avatar Jul 13 '20 15:07 TetoTheSquirrelFox

I was thinking : this documentation is really centered to shape, and does not talk about shaders, hair, skeleton, ... that much. Maybe another step should be written about other features.

TetoTheSquirrelFox avatar Jul 13 '20 16:07 TetoTheSquirrelFox

@animate1978 : I discovered, while writing my post about skeleton, that this solution of adding separated folders brings bugs with creation tools (when you create/load config file and models). I'm on it and push a commit when it's done. I have to finish tomorrow, after that I'm unavailable for a while. ^^

TetoTheSquirrelFox avatar Jul 15 '20 14:07 TetoTheSquirrelFox