Jump to content
AuthenticPeach

The One Stop Shop for 3D Modeling: From Blender to Zomboid!

Recommended Posts

Posted (edited)
Hello and Welcome! Here you will find a concise and comprehensive guide and tutorial of making 3D models for Project Zomboid.
 
Currently, this will mainly pertain to custom Clothing creation but may include weapon creation in the future. This will present how to create models from scratch with Blender and bringing them into the game. I would like to emphasize that with the right optimization, you can bring any model into Zomboid.
 
Step 1) Installation and setup
 
 
 
You will need to install the newest version of Blender and Notepad++ for this guide.
Download Blender 2.93 : https://www.blender.org/download/
 
Some additional tools I recommend having are DirectX Viewer from Microsoft and Fragmotion.
DirectX Viewer helps you view .X files. : https://www.microsoft.com/en-us/download/details.aspx?id=6812
1137159602_bandicam2021-06-1900-22-31-087.jpg.8a63a17ce78b0ba93d40b0449fa436b1.jpg
Figure 1 : UI of Direct X Viewer with the Crash Helmet model
 
Fragmotion greatly helps making Vanilla model retextures: http://www.fragmosoft.com/downloads/index.php
 
2060996437_bandicam2021-06-1900-32-51-253.thumb.jpg.e23723682cfab2fc17cf5ae106e06fe1.jpg
Figure 2 : View of the Fragmotion UI  with the textured Crash Helmet model
 
All of these programs are free and fairly simple to get into.
 
     
Step 2) Model creation
 
 
 
Project Zomboid supports two file types - X and FBX. There are two types of models that are used within the game, static and skinned. Static models are models that are stationary and initially have no animation attached to it. Skinned models are models that are connected to a character animation bone and exported with an animation.
 
Some basic knowledge of Blender is required. You have to know how to import, export, and scale models, navigate the UI, zoom in and out, etc. As such, I can not go through every step to make the model in Blender, there are many tutorials on YouTube for many types of models.  Many people use reference images to assist them in the modeling process. Yet, this is not a dedicated Blender tutorial. However, there are a few rules to follow to cater the model to Zomboid levels.
 
1. Flip Normals when Necessary.
Make sure the face orientations are all blue on the faces you want to be visible.
You can find this tool by hitting the drop-down in the top region of the screen.
 

                  bandicam-2021-06-19-00-45-05-321

Figure 3 : Blender viewpoint showing the face orientation mode switch
 
If any regions are red, that means that the face will be invisible when imported in the game, therefore the normals must be flipped. Flipping the normals are found, normally on the top left region of the screen, in the mesh drop-down. 
BlenderFaces.thumb.png.543fdfc24ba015b2dee2d41bb5cb2efa.png
Figure 4 :  Face Orientation Differences
 
Flip Red Invisible faces to Blue
Figure 5 :  Blender location of the Flipping Normals switch
 
2. Optimize Face Amounts. 
A model should have around or less than 3000 faces to not affect game performance. Use the decimator tool to lower the face amounts to meet the low-poly standards of the game. The decimator tool can be found under the modifiers tab. Make sure to apply the change.
 
1508475618_bandicam2021-06-1902-02-52-858.jpg.21a0eedc2c5adfa112c33cedb882aa24.jpg
Figure 6 : Model example of high face statistics
 
A model with statistics like this is too large and detailed. It will cause lag to the game. Use the decimate tool to optimize it. 
872699181_bandicam2021-06-1902-00-05-765.jpg.1e3d0f2272b741c2a8b43a201d96ca6c.jpg
Figure 7 : The Modifier tab where the Decimate tool is located
 
BlenderDecimate.thumb.png.436fabaa14d277293271504fb0ee27cc.png
Figure 8 : Location of the Decimate tool within the modifier tab
 
179610173_bandicam2021-06-1902-09-51-124.jpg.5ce7d362abaf0629d99581b0abe1a047.jpg
Figure 9 : Decimate tool in use to lower the number of faces
 
Bring it down to around or below 3000 Faces.
610719289_bandicam2021-06-1902-28-56-955.jpg.2f53ede3d4bbb75b0a94f74cd10d2187.jpg
Figure 10 : Applying the decimate modifier 
 
Apply the change. 
 
3. Make neat and versatile UVs.
1964856393_bandicam2021-06-1902-35-43-428.thumb.jpg.7f2f20b9ecd128ae4f101cb840df37fc.jpg
Figure 11 : The UV Editing / UV mapping viewpoint. The left side shows the Face layout. CTRL + A on the right side makes all the faces show up on the left. 
1673999704_bandicam2021-06-1523-58-28-784.jpg.47f63cb77e5777c0c96c19a9e37a7535.jpg
Figure 12 : Stovepipe hat model final product with the text. 
 
There are a few ways to make your textures, whether the be the standard UV map method or the face paint method. It generally is a good practice to make your UV maps in a clean and organized way, so you may use them later. For instance, a Bad or lazily made UV map may limit your choices when making a car model when you go to designate the masks.
 
4. Scaling Matters.
Upon your first input of your model, chances are you may come across scaling issues where your model is gigantic compared to everything else.
 
1699798900_bandicam2021-06-1903-01-50-353.jpg.3feb385bb5b1d8cbc0a692b7b1069829.jpg
Figure 13 : Giant model that needs to be scaled down
 
I also recommend leaving Blender open and scale and export your model until you are satisfied with it. Models are automatically updated when the game is run, which makes testing for the correct scale fast. 
Here are the export settings I have for models. I typically export to .FBX
313413993_bandicam2021-06-1701-13-19-838.jpg.19cfcde2cdd2babf5a5e031c52f6e7e4.jpg1465216186_bandicam2021-06-1903-13-43-655.thumb.jpg.d289047af0c048d56531d8830273a9b5.jpg
 
Figure 14 : Scale is set to 1,1,1 on the right side "Object Properties tab"
Figure 15 : Export settings are set to 0.01 to bring the scale down to near ideal levels for Zomboid. You may need to use
the scale tool (hotkey 'S') to add to the effect.
 
 
5. Apply Transforms.
Typically speaking, you want to have your model set at the origin point. Pertaining to Weapon models - Have the rear end of your weapon located at the origin point. If you have made any intentional adjustments when it pertains to scaling, translating, or rotating, make sure to apply that by using CTRL + A and clicking apply transforms before exporting your file. 
BlenderApplyTransforms.png.d462cc42c027d577bca77184d4ff29f7.png
Figure 16 : Apply menu brought up by CTRL + A. Note: this can only be brought up in Object mode.
 
     
Step 3) Skinned model or not? If not, Export your model and go onto the next step.
 
 
 
When determining if your model should be static or skinned, you have to take a look at your model and decide if it is necessary. Typically, all clothing, backpacks, and hair models are skinned models. Hats, however, are typically static. Vehicles (at the moment), weapons, and miscellaneous objects are typically static. Skinned models have their own process of creation. 
 
1. Align & scale to player models.
To start, you need to import the vanilla player models which were adjusted and tweaked by ThrottleKitty:
 
1746969446_bandicam2021-06-1903-44-32-848.thumb.jpg.3f387ba34d3073fcee1417ab346954be.jpg
Figure 17 : Cigarette model to be made into a skinned model. ThrottleKitty's reference model is also shown. 
 
2. Ctrl + A, Apply all Transforms.
BlenderApplyTransforms2.png.22514708958e1984cdadb25bfc07fd15.png
Figure 18 : Apply All Transforms in Object Mode. This will bring the model's orange point to the origin point (0,0,0) . 
 
Here is what it should look like with the model orange point set to the origin point: 
  bandicam-2021-06-19-03-53-11-223
 
3. Parent your model to the bone structure.
First Select your model THEN your bone structure (While holding down Shift), Control + P to apply with automatic weights (This step is all in Object mode).
Image of that: https://ibb.co/GMfMvqr
After doing so, your model should have been merged into the reference model hierarchy of "dummy01".
 
4. Delete your reference model and the unused bones.
The goal here is to isolate a bone or some bones to link to our model. Select the bones that we want to keep, in this case, it's the head bone Bip01_Head.
Switch to Edit Mode, Select both end spheres of each bone you want and hit Ctrl + I to invert the selection to everything else. Hit Delete and confirm to delete the bones. 
 
Deleting the Reference model: https://ibb.co/BT4NsN4
Only Selecting the wanted bone(s): https://ibb.co/2K22bHk
Selecting every other bone via CTRL+I: https://ibb.co/3C7CRjb
Confirm to delete the bones: https://ibb.co/n6ZRrPx
Goal Accomplished: Imgur: The magic of the Internet
 
5. In your Object Data Properties menu, Remove the vertex groups that you are not using.
Under Vertex groups, hit the  Minus button to remove the vertex groups that you don't need, other than from what you are using. In our case here, we will only keep Bip01_Head.
 
Navigating to the Object Data Properties Menu: https://ibb.co/kH2JWhr
Removing the unneeded Vertex Groups: https://ibb.co/px7rvbP
 
6. Assign the necessary vertex groups to your model.
Hit tab, then "a" to select all, then click the Assign button with that or each vertex group to assign it.
Assigning the vertex group to the model: https://ibb.co/MfMNLvj
 
From there you are ready to export your model to .FBX with the default export settings and see it in-game. The next step will show how to create your scripts to bring your item into the game.
 

     

Step 4)  Creating the clothing item scripts
 
 
                When creating your mods folder structure, use the main PZ file directory as a reference, replacing MOD_NAME with the name                    of your mod for whatever file used.
 
1. The next part involves making an addition to the `script.txt` file and importing it into base. You can choose whether or not to have a module name.
Here is a script example located in: `\mods\AuthenticZClothing\media\scripts\clothing\PZAZ_clothing_jacket.txt`
 
module AuthenticZClothing {
imports {
       Base
  }
 
bandicam 2021-06-19 05-49-07-134.jpg
Figure 19 : Script entry of a new jacket
 
       item Jacket_Grimes                                /** ClothingItem name **/
       {
       Type = Clothing,
       DisplayName = Rick's Jacket,                 /** This is the name that appears in the inventory menu in-game. **/
       ClothingItem = Jacket_Grimes,              /** This is the name of the XML clothing item that you need to refer to correctly.
       BodyLocation = Jacket,                           /** This refers to Bodylocations.lua which controls the restrictions on                                                                                                   what combinations of clothing  that can be worn. **/
       Icon = JacketRick,                                     /** Inventory icon for the jacket. The sprite is named item_JacketRick in the textures                                                                           folder in the mod directory. **/
....
 
2. Connect the script with a new `.xml` clothing item (you refer its name id in its script file)
 
\AuthenticZClothing\media\clothing\clothingItems` -> `Jacket_Grimes.xml`: bandicam 2021-06-19 06-01-09-611.jpg
Figure 20: The clothing item .XML file for Jacket_Grimes
 
If you are unsure on what masks you will need with your clothing item, you should refer a similar vanilla item or refer to this graphic which was made by Scavenger:
 
Mask-IDs  
 
3. Get a unique GUID (Globally Unique Identifier) by going to https://www.guidgenerator.com/online-guid-generator.aspx, and copy/paste in a new GUID into its respected section (Line 5 in the clothing item, above). All clothing items, including makeup, get their own GUID. You will use this ID code in every `.xml` file that you want to use this clothing item in.
 
4. Then you also add an addition to the GUID table, a reference file that the game uses for all clothing items. Note: You don't need to add in all of the vanilla assets if you do not intend to have your custom clothing spawn on zombies. If you don't want to, just create a new GUID table with only your asset information in it. 
 
 
bandicam 2021-06-19 06-06-12-305.jpg
Figure 21: Jacket GUID table entry found from 'AuthenticZ\media -> fileGuidTable.xml'
 
 
 
Step 5) Testing your Model
 
 
Your item should now be able to spawn in-game, via -debug mode. Of course, you got to add distributions to it if you want it to naturally spawn in the world. This guide will not cover adding items to a distributions .lua file until the new distributions created by Baph are implemented in the IWBUMS branch. 
 
Here is a link to the guide which will instruct you on how to enable debug mode and test your item: 
 
Possible Issues that you may run across:
1. The item will not appear in the item spawn list, this is probably from you not referencing the clothing item name correctly in the script.
 
2. The clothing item will appear with a red and white checkerboard texture - that comes from not referencing the texture file correctly in the .XML file.
 
3. The item will appear in inventory but appears invisible on character - this is probably because it did not get a new GUID table addition OR the reference in the .XML clothing item file is off.
 
And then, of course, you got to give that clothing item an inventory icon, which you reference in the `/media/textures` file with `item_YourIcon.png`.
 
4. The item appears in your inventory, but its sprite spawns in a rainbow fashion and the item appears invisible on the character. If you are getting this problem, its an issue with your GUIDs. Your GUID may be referencing two different XML files in which the game freaks out in trying to determine what XML file to use.
  20210628014315-1
 
Step 6) Extra things to do with 3D models
 
 
Presently, there are two main ways to spawn 3D models on zombies: Clothing items and Weapon attachments.
 
How to make custom clothing appear on zombies (via clothing items)
 
1. Go to `clothing.xml`, located in `media\clothing`, and take a look at the format of the outfits.
These are outfits that the game designates onto zombies. Making a new one correctly will add it to the game's list of zombie outfits.
bandicam 2021-06-19 06-17-13-154.jpg
Figure 22 : Full outfit of Rick Grimes from Clothing.XML
 
2. Do note that this would create a *"Male only"* zombie outfit. Replacing the top and bottom cases in a new outfit with a `<m_FemaleOutfits>` and `</m_FemaleOutfits>` will create a female variation. Reuse that GUID for the female variation to have the game recognize both sexes of an outfit - this pairs them. (It won't be exclusive to sex)
 
3. If you set to spawn a zombie in `ZombieZoneDefinitions.lua` and it is a sex exclusive outfit (Male or Female only), You have to state it as such or the game will try to spawn the other sex, realize that it doesn't exist, then default to choose and spawn a random outfit from its `clothing.xml` list.
Screenshot of Zone example: https://ibb.co/Y00Bs2G
 
4. There are two other files that you can use to customize your zombie outfits - "HairOutfitDefinitions.lua" and "AttachedWeaponDefinitions.lua" which you place later in the following mod directory: '\media\lua\shared\Definitions` - In `HairOutfitDefinitions.lua`, you can designate one specific haircut or a range of haircuts for that zombie outfit. It is recommended that you look at beardStyles.XML and hairStyles.XML which are located in 'media\hairStyles'. 
An addition typically looks like this (taken from AuthenticzZ_HairOutfitDefinitions.lua): https://ibb.co/HNBynsm
 
5. In `AttachedWeaponDefinitions.lua`, you can choose what items will spawn attached to the zombie for that outfit.
 
Final Result of Rick Grimes zombie:
 bandicam-2021-06-20-10-44-39-653

 

 

Regarding 3D Car models

 

 

 

 

Thanks a ton to the people that taught and assisted me along the way to learn Blender for Zomboid - DETOX, Maxwell218, PawLow, and Shark!

Edited by AuthenticPeach

Share this post


Link to post
Share on other sites

I have been making a Monster Energy Can in Blender, but I can never get it to position right in the hands and have it be drinked normally.

I used CTRL +A and applied transforms and I scaled it to 0.10 which seems to be a good size but the model always appears behind my character hands. I have no idea why :(

20210718182721_1.jpg

Share this post


Link to post
Share on other sites
On 7/18/2021 at 10:11 AM, Josko said:

I have been making a Monster Energy Can in Blender, but I can never get it to position right in the hands and have it be drinked normally.

I used CTRL +A and applied transforms and I scaled it to 0.10 which seems to be a good size but the model always appears behind my character hands. I have no idea why :(

20210718182721_1.jpg

I recommend importing the vanilla water bottle or soda can and use that to orientate it correctly. Make sure the can is at the main origin point. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

Loading...

×
×
  • Create New...