Modding:VS Model Creator tutorials: Difference between revisions

From Vintage Story Wiki
No edit summary
m (Veerserif moved page VS Model Creator Tutorials to Modding:VS Model Creator tutorials without leaving a redirect: Part of translatable page "VS Model Creator Tutorials")
 
(4 intermediate revisions by 2 users not shown)
Line 103: Line 103:
[[File:Vsmc_9.png|thumb|center|800px]]
[[File:Vsmc_9.png|thumb|center|800px]]
 
 
== Parenting == <!--T:29-->
The parenting system allows you to attach models to the individual parts of a set backdrop model. This is is how armor models stay attached to the arms and legs of the player model while that model is performing its own set animations like running or crouching. This tutorial will cover how to use this system to implement armor models onto the player; but the same method can be used to implement custom clothing models or hair styles for the player. If you use a different backdrop you can add custom accessories to any animated model of your choice.
[[File:Vsmc 19.png|thumb|center|800px]]
&nbsp;
<!--T:30-->
Now there are two ways to start, the first method starts with an existing parented model from the game, this is far easier than the second method, but it's not as flexible. This will help you learn how the models in the base game are parented so you can eventually create your own from scratch. The second method shows you how to parent any shape to any backdrop element, which gives you far more freedom.
&nbsp;
<!--T:31-->
'''For method #1:'''
Start by importing the shape json of an item that is similar to what you want to add, here we will be using the "legs.json" file located in your game directory and nested in- ''Vintagestory/assets/survival/shapes/entity/humanoid/seraph/armor/plate'' Go ahead and import this model into the Model Creator by dragging and dropping it into the window. This should usually prompt you with a window asking to import a backdrop shape:
[[File:Vsmc_20.png|thumb|center|800px]]
&nbsp;
<!--T:32-->
Sometimes it will not prompt you with an import window and you will need to manually set the backdrop. You can do this by going to the tab "project" at the top of the window and select "Set Backdrop...":
[[File:Vsmc_21.png|thumb|center|800px]]
&nbsp;
<!--T:33-->
In the import backdrop pop up window navigate to the following location for the appropriate seraph shape json to import, you should use seraph-hairless.json located in ''Vintagestory/assets/game/shapes/entity/humanoid/seraph-hairless'' for most things as it's the cleanest model to work with, but you can always create your own custom backdrop version with certain elements removed like the clothing tiles to strip the model down even more. You can also delete the face cubes if they are in the way. If you edit the seraph shape json be sure to save it as your own version and try not to mess with the naming of the major body parts, preferably name it something like "seraph-backdrop" and place it in an easily accessible location so you can easily import the file again.
[[File:Vsmc_22.png|thumb|center|800px]]
&nbsp;
<!--T:34-->
With the backdrop set your model workspace should look like the first image, note the leg armor model is still bunched up in the corner, sometimes the model will update itself and automatically fix itself, but most of the time you will need to update it manually. You can update the model by selecting any piece of the leg armor model and moving its position once in any direction, then just press ctrl + z and undo the move. This should update the model and then it will look like the second image:
[[File:Vsmc_23.png|thumb|center|800px]]
[[File:Vsmc_24.png|thumb|center|800px]]
&nbsp;
<!--T:35-->
Now that you have the model and backdrop loaded into the model creator you are free to edit the shape however you'd like, just be sure to make your edited/added shapes branch off the original parts, the original parts are pre-parented to the backdrop so any newly added voxels must be attached to the tree of that part. Note how in the image "ArmorKneeSide9" is attached to and under the tree of "ArmorLowerLegL", Most major shapes at the start of trees or under the root are usually parented to the backdrop already. Just export the finished shape json and use it as normal, and be sure to edit the texture locations in the exported json to their correct locations.
[[File:Vsmc_25.png|thumb|center|800px]]
&nbsp;
<!--T:36-->
'''For method #2:'''
This method should be used if you already have a model created and want to parent it to the appropriate part of the body. We will start with these boots, which I want to attach to the bottom of each leg on the player model.
[[File:Vsmc_26.png|thumb|center|800px]]
&nbsp;
<!--T:37-->
Navigate up to the tab "project" at the top of the window and select "Set Backdrop...", as mentioned in method #1 you should use the seraph-hairless.json shape located in ''Vintagestory/assets/game/shapes/entity/humanoid/seraph-hairless'', or a custom stripped down version. Select your backdrop shape of choice and then press the "Import backdrop" button on the pop-up window.
[[File:Vsmc_27.png|thumb|center|800px]]
&nbsp;
<!--T:38-->
Your model creator window should now show an un-textured seraph model in in the center like this:
[[File:Vsmc_28.png|thumb|center|800px]]
&nbsp;
<!--T:39-->
Next select the part of your shape that you want to have attached to the backdrop model, here we are selecting the right boot main cube (it's the main cube because all the detail cubes are attached to it in the element tree), next scroll down on the left side of the model creator window and at the bottom you will see a "Not set" button under "Stepparrent element", press this button and you will see the following pop up window:
[[File:Vsmc_29.png|thumb|center|800px]]
&nbsp;
<!--T:40-->
Now in this pop-up window you will need to select the part of the backdrop model you want this cube you selected to be attached to, in this case I selected the right boot's main cube so I want it attached to the lower part of the right leg which in this case is all the way at the bottom of the "Element" drop down list. Once you select the right element go ahead and press the "Apply" button.
'''Note:''' the element names under this drop down menu correspond to the exact names on the player model used in game, this is why it's important to not rename them if you use a custom backdrop model. Also if you don't know what an element corresponds to name wise simply open up the backdrop shape file your using in a separate model creator window and select the element you want to know the name of and it should show in the left window under the "New element" button and tree window.
[[File:Vsmc_30.png|thumb|center|800px]]
&nbsp;
<!--T:41-->
After pressing the "Apply" button in the window it should close and then attach that cube to the backdrop element you selected in the list:
[[File:Vsmc_31.png|thumb|center|800px]]
&nbsp;
<!--T:42-->
Now repeat this process for each element you want attached to the backdrop model, you may need to modify the position of each model to properly align it to the backdrop. Also, when creating armor/clothing models be sure to separate the model up into several major cubes so they are easy to parent to the seraph model, for instance break up the leg armor into two major sections- the upper and lower leg, then add your detail cubes under the tree/ attached to one of these major parts. Nearly every single shape that shows up on the player model can be imported/parented/and edited this way, and you can also extend this process to create armor models for other entities like adding trader clothing.
[[File:Vsmc_32.png|thumb|center|800px]]
&nbsp;
<!--T:43-->
{{Navbox/modding}}
</translate>
</translate>

Latest revision as of 00:14, 12 August 2022

Other languages:

Vintage Story has its own model creator called VS Model Creator that allows anyone to create, texture, and animate custom shapes for use in Vintage Story mods. The newest version can be downloaded here.

Below you can find modified versions of a modeling tutorial and an animation tutorial created by Balduranne and Luke, respectively. Click here if you would like to visit the original thread where these tutorials were originally posted.

Vsmc 1.png

Modeling

Modeling Basics

The model creator only allows working with cubes or parts of cubes, which you can create by clicking the Red/Green/Blue icon below the selection window. Once you have something selected, you can get to the modeling proper - Voxel Size determines the shape and size of the object, Position moves it around the grid, while Origin is from where the model is supposed to 'start' from. This mostly comes into play when rotating the object.

Vsmc 2.jpg

 

When adding more cubes, it's important to keep in mind what you have selected - In this case, Cube2 is docked under Cube1, so if we move the latter, Cube2 will end up moving along with Cube1. Cube 3 in this example is sitting on its own, and is unaffected by the other two.

Vsmc 3.png

 

After a little fiddling, we have our model. In this case it's a candle holder with a candle:

Vsmc 4.png

 

Model Duplication

Very often you'll want to duplicate an element and move it around to speed up the modelling process. It's less time consuming than making a fresh object and moving it in the correct place and shape:

Vsmc 10.png

 

I'm sure very often you'll find yourself just applying the same texture to the entire object. This is where the Entity Texturing Mode comes into play:

Vsmc 11.png

 

Once clicked, the entire model will be assigned one texture. It's handy, but we still need to tweak it by hand. While the mode is on, you can only move an entire object around in the UV map editor (Left), that's hardly ideal in some cases. That's why we want to disable the Entity Texturing Mode (Don't worry, the texture will stay on), and go back to the Face menu and manually move the texture around.

Vsmc 12.png

 

This is especially important in cases where we want to use a single texture for a model, as is the case with my Loom model, or the NPC models (Including the player one):

Vsmc 13.png

 

Furthermore, if you're using one texture, you can tweak the texture size for larger objects:

Vsmc 14.png

 

Vsmc 15.png

 

Another useful trick is exporting the UV map of your model. Once you have it unwrapped (That is, spread around your texture sheet), you can export the UV map to make a proper texture for it, or in the case of the player model - Make your own skin for it:

Vsmc 16.png

 

That should about cover the basics. One important thing to keep in mind is that one block is 16x16x16 (The size of the grid) in the editor.

Model Editor controls, for reference - They're in the Help submenu (It really helps to memorize them!):

Vsmc 18.png

 

Once you have the hang of it, you can use Render Passes. An explanation of the different modes can be found by clicking here, but In laymans terms, they determine how a block will behave visually (Think - Glass, Ice, etc):

Vsmc 17.png

 

Texturing

Once we have our model, we can slap some textures on:

Vsmc 5.png

 

Let's look at this interface - Textures are assigned separately for each side of the model, which we need to apply manually. We can speed it up by clicking Copy and then Paste for every side. If a side is not going to be visible in game, you can deselect "Enabled", which will make that side invisible.

Vsmc 6.png

 

But first we need to click Image and import a texture we want to use. To make life easier, you can set the default texture path to take textures from. This is useful if you're going to use vanilla textures. Once a texture is imported - Click on it and select Apply. Please note that if your texture is outside of the game folder when Imported, you will need to tweak the model's shape (.json) file to reflect its location for the game. You will have to do this most of the time.

Vsmc 7.png

 

If we want to fine tune our UV Mapping (Aka how the texture is lined up on the model), we can use the Face UV controls to change the shape of the face. In this case, we stretch it out so that all the rivets are visible. One should also drag and move around the individual faces in the leftmost menu for best effect:

Vsmc 8.png

 

Once we're satisfied with the effect, we can save the model and use it in a mod:

Vsmc 9.png

 


Parenting

The parenting system allows you to attach models to the individual parts of a set backdrop model. This is is how armor models stay attached to the arms and legs of the player model while that model is performing its own set animations like running or crouching. This tutorial will cover how to use this system to implement armor models onto the player; but the same method can be used to implement custom clothing models or hair styles for the player. If you use a different backdrop you can add custom accessories to any animated model of your choice.

Vsmc 19.png

 

Now there are two ways to start, the first method starts with an existing parented model from the game, this is far easier than the second method, but it's not as flexible. This will help you learn how the models in the base game are parented so you can eventually create your own from scratch. The second method shows you how to parent any shape to any backdrop element, which gives you far more freedom.  

For method #1: Start by importing the shape json of an item that is similar to what you want to add, here we will be using the "legs.json" file located in your game directory and nested in- Vintagestory/assets/survival/shapes/entity/humanoid/seraph/armor/plate Go ahead and import this model into the Model Creator by dragging and dropping it into the window. This should usually prompt you with a window asking to import a backdrop shape:

Vsmc 20.png

 

Sometimes it will not prompt you with an import window and you will need to manually set the backdrop. You can do this by going to the tab "project" at the top of the window and select "Set Backdrop...":

Vsmc 21.png

 

In the import backdrop pop up window navigate to the following location for the appropriate seraph shape json to import, you should use seraph-hairless.json located in Vintagestory/assets/game/shapes/entity/humanoid/seraph-hairless for most things as it's the cleanest model to work with, but you can always create your own custom backdrop version with certain elements removed like the clothing tiles to strip the model down even more. You can also delete the face cubes if they are in the way. If you edit the seraph shape json be sure to save it as your own version and try not to mess with the naming of the major body parts, preferably name it something like "seraph-backdrop" and place it in an easily accessible location so you can easily import the file again.

Vsmc 22.png

 

With the backdrop set your model workspace should look like the first image, note the leg armor model is still bunched up in the corner, sometimes the model will update itself and automatically fix itself, but most of the time you will need to update it manually. You can update the model by selecting any piece of the leg armor model and moving its position once in any direction, then just press ctrl + z and undo the move. This should update the model and then it will look like the second image:

Vsmc 23.png
Vsmc 24.png

 

Now that you have the model and backdrop loaded into the model creator you are free to edit the shape however you'd like, just be sure to make your edited/added shapes branch off the original parts, the original parts are pre-parented to the backdrop so any newly added voxels must be attached to the tree of that part. Note how in the image "ArmorKneeSide9" is attached to and under the tree of "ArmorLowerLegL", Most major shapes at the start of trees or under the root are usually parented to the backdrop already. Just export the finished shape json and use it as normal, and be sure to edit the texture locations in the exported json to their correct locations.

Vsmc 25.png

 

For method #2: This method should be used if you already have a model created and want to parent it to the appropriate part of the body. We will start with these boots, which I want to attach to the bottom of each leg on the player model.

Vsmc 26.png

 

Navigate up to the tab "project" at the top of the window and select "Set Backdrop...", as mentioned in method #1 you should use the seraph-hairless.json shape located in Vintagestory/assets/game/shapes/entity/humanoid/seraph-hairless, or a custom stripped down version. Select your backdrop shape of choice and then press the "Import backdrop" button on the pop-up window.

Vsmc 27.png

 

Your model creator window should now show an un-textured seraph model in in the center like this:

Vsmc 28.png

 

Next select the part of your shape that you want to have attached to the backdrop model, here we are selecting the right boot main cube (it's the main cube because all the detail cubes are attached to it in the element tree), next scroll down on the left side of the model creator window and at the bottom you will see a "Not set" button under "Stepparrent element", press this button and you will see the following pop up window:

Vsmc 29.png

 

Now in this pop-up window you will need to select the part of the backdrop model you want this cube you selected to be attached to, in this case I selected the right boot's main cube so I want it attached to the lower part of the right leg which in this case is all the way at the bottom of the "Element" drop down list. Once you select the right element go ahead and press the "Apply" button.

Note: the element names under this drop down menu correspond to the exact names on the player model used in game, this is why it's important to not rename them if you use a custom backdrop model. Also if you don't know what an element corresponds to name wise simply open up the backdrop shape file your using in a separate model creator window and select the element you want to know the name of and it should show in the left window under the "New element" button and tree window.

Vsmc 30.png

 

After pressing the "Apply" button in the window it should close and then attach that cube to the backdrop element you selected in the list:

Vsmc 31.png

 

Now repeat this process for each element you want attached to the backdrop model, you may need to modify the position of each model to properly align it to the backdrop. Also, when creating armor/clothing models be sure to separate the model up into several major cubes so they are easy to parent to the seraph model, for instance break up the leg armor into two major sections- the upper and lower leg, then add your detail cubes under the tree/ attached to one of these major parts. Nearly every single shape that shows up on the player model can be imported/parented/and edited this way, and you can also extend this process to create armor models for other entities like adding trader clothing.

Vsmc 32.png

 

Icon Sign.png

Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.

Modding
Modding Introduction Getting Started Theme Pack
Content Modding Content Mods Developing a Content Mod Basic Tutorials Intermediate Tutorials Advanced Tutorials Content Mod Concepts
Code Modding Code Mods Setting up your Development Environment
Property Overview ItemEntityBlockBlock BehaviorsBlock ClassesBlock EntitiesBlock Entity BehaviorsWorld properties
Workflows & Infrastructure Modding Efficiency TipsMod-engine compatibilityMod ExtensibilityVS Engine
Additional Resources Community Resources Modding API Updates Programming Languages List of server commandsList of client commandsClient startup parametersServer startup parameters
Example ModsAPI DocsGitHub Repository