Jump to content
tubetarakan

Complete Vehicle Modding Tutorial

Recommended Posts

Hello and welcome to my tutorial. It covers full workflow of vehicle creation for PZ. If you are a complete beginner in 3D modelling, you'll have to watch/read additional tutorials, I won't cover every aspect of model creation and 'where this button is located'.

I divide vehicle creation in these stages:

1) Modelling

2) Wheels texture and modelling

3) Texturing

4) Packing files in folders

5) Editing scripts and .lua

6) In-game editing and tests

7) Workshop publish

 

STAGE 1 - MODELLING

Today I am creating a 1960 Ford Falcon

1200px-1960-Ford-Falcon-4dr-Sed.jpg

 

I prefer using blender as it is my everyday 3d modelling software. Now, find references for your vehicle and ideally it will be a blueprint/outline scheme, like this one:

 

xQReYuO.png

 

There are some tips in modelling for PZ:

1) Do not care too much about topology and good shading. There is no actual shading in game, only windows have reflections. 

2) Avoid n-gons or triangulate them before export

3) DO NOT make edges to outline body panels/parts. All dividing of parts will be done with texture mask. You can do it in UVs if there will be a point for that.

4) Place spindiel imitations in wheel wells to hide rear part of wheel models

5) In the UVs  parts of body have to be straight-oriented without any non-90 degrees rotation, so pixels in texture will lay parallel with polygon flow.

6) To avoid physics artifacts in game import model of one of vanilla game cars models to your scene and model in consistent scale. Or import mine, that is available in the end of topic.

 

 

This is what I consider a well done model

 

FqBkE3e.png

 

There is nothing special in UV unwrapping process, just remember to place the least amount of seams possible and keep island aligned. Here are the UVs of my model:

 

OVok4ku.png

 

I've unwrapped the model without applied mirror modifier, so now we will have to texture just one half of the car. I'll fix mirroring later.

 

 

 

 

STAGE 2 - WHEELS

 

There are many ways to make a wheel and texture it, but I'll show the most efficient one. Make the wheel's face with simple materials, but unwrap the 'road touching part' to flat surface, like this:

 

fBL3Wlo.png

 

 

 Then place an orthographic camera facing the wheel, scale it to fit the whole wheel-dish. Place a ring with emission material to light the wheel. Switch your renderer to Cycles and go to camera view, now use a rendered shading mode to adjust materials and lights to your taste. 

 

52iMHE2.png

 

 

Set rendering resolution to something like 120x120-175-175 for best results

Check the 'transparent' box in film settings to have alpha backround in texture:

 

qdvwYsL.png

Now increase the sample count to something like 512-1024 and hit render. You will end up with a result of a ready-to-go wheel texture:

 

XgHyW2J.png

 

The example file with scene for rendering and the model of this wheel you can download here: *google drive .blend file*

Now make a lowpoly model of the wheel to use this texture on. I prefer using 18-24 edge circles for wheels. The unwrapping will be later, but eventually you'll end up with this:

 

0TtmX8i.png

 

This method takes 10-15 minutes when you get used to it and gives a stunning and clear result.

 

 

STAGE 3 - TEXTURING

 

NOTE: I use a pretty complicated way of texturing and adding light to model. All rules of using textures the default way are covered in "HOW TO CREATE NEW VEHICLE MODS" topic by RingoD123, one of PZ devs. You can access it here: *boop*

 

I'll show you my way, using Substance Painter to apply lighting and fake chrome parts to model. But first comes the base color and details of the car, so let's dive into it.

Create a texture with 0 alpha and resolution 256x256. You can go for 512x512, but personally I like pixelated look of lo-res texture. Here are the settings for initial image:

 

bpEPvKG.png

 

To preview the texture you are painting with different car colors, use this node setup. But switch filtering mode from "Linear" to "Closest", I forgot to do it on screenshot.

 

XCPqLbw.png

 

There are two types of texture details: somewhat transparent and absolutely opaque. Half-transparent parts will be affected by car color, so they are mostly shadow/highlight details. Headlights, fixtures and things like that have to be opaque and painted with 100% brush hardness. 

It is easier to keep 3d view just to see what are you doing and paint texture in image editing mode, right there:

 

t9RCAAt.png

 

First, paint the outlines of doors and other opening parts. Here are some brush hardness values:

0.2 - Outline shadow

0.5 - Outline

1.0 - Fake chrome and rubber window sealing

 

Some work in progress screenshots

 

HRAXRkj.png

 

Now when you have windows frames, save the image you just painted and go to photoshop and mask out glass sections like that

jj9uDUk.png

 

Well, time for Substance Painter. You can use photoshop gradients for windows and blender lighting for lighting of the body, but I'll use SP "Baked lighting" filter for that, and for chrome especially. I will briefly describe what I've done in SP:

1) Mask out windows, give them mirror metal material and add a filter to them

2) Mask out chrome parts, made them mirror metal and added the same filter with slightly different settings.

3) Apply the same filter to all body parts left.

4) Add a position gradient to the windows

Now I have this result, it is not shaded model, just basecolor:

 

dascELz.png

 

Also export the AO map you baked in SP.

 

You can download file with this scene to look through and get ideas using this link: *boop*

 

 

Now paint additional details you want on the car and open Photoshop. This is your layers layout:

 

OvJX5Ia.png

 

Now save it as .psd for future color editing and as .png to see what the you've done. Plug .png direcly as BaseColor in shader settings. Set your shading setting like this:

 

m6vJXKx.png

 

And check if everything looks ok. This is my result:

 

ilswvEE.png

lPrPJDw.png

 

And this is the vehicle's look with wheels that we made before

 

qaVWw5C.png

 

Sweet, isn't it?

 

Now, it is time to get rid of mirroring. You can make new UV, bake it and... get A LOT of offset artifacts resulting in jagged pixel edges. There is a lazy but effective method:

 

1) In the UV editor place cursor in the 0,0 coordinates. 

 

cWh05jK.png

 

2) Set Pivot to 2D cursor:

 

OZ9Euao.png

 

3) Scale all UV islands to 0.5 EXACTLY

 

fkLifuP.png

 

4) Apply mirror modifier to your model. Now select FACES of any half of the model and move it in UVs on Y by value 0.5 EXACTLY or you'll eventually mess everything up.

 

9vngDp3.png

 

5) In Photoshop expand canvas of your PSD file we made before

 

iAFwUaV.png

 

6) Duplicate everything and move to the upper left corner, like in UVs. You can merge color layer(s) to operate color on export more easily. Now you have half of the texture empty... You do not want to waste it, right? Then drop in the wheel texture here without scaling, and you won't need additional texture file for it!

 

8u0VwLf.png

 

7) Create a layer beneath all others and paint it black or grey to cover alpha-holes in the textures.

 

VWPZQIX.png

 

8 ) Now unwrap the wheel to this new texture and let it shine! We painted the car and fixed mirroring.

 

DOWNLOAD THE .PSD FILE: *bloop*

 

There are 3 more types of textures to make:

1) Rust

2) Damage (1 or 2 levels, I'm lazy, I prefer using single one)

3) ID Color Mask or just Mask

 

It wasn't possible to make them right with mirroring. 

Everything about these textures are explained clearly in Ringo's guide, again: *boop* I'll just show results I ended up with. 

Now you have to use 512x512 clear images for these textures, do not forget it.

 

RUST

 

Painted it with jitter brush and 0.2 hardness. To see what I am doing used the same node setup, as for base texture. 

tyLJGWU.png

IES9XK7.png

 

DAMAGE

 

Painted gradients with black and white with 0.1 hardess with repetitive strokes.

 

FPtSYDU.png

n9saFh5.png

 

MASK

 

Mask texture tells game where are separate parts of car: doors, windows, lights and others. Every part has it's own color in palette, you can find color table in Ringo's guide. Copy and paste color HEX to use it in blender brush or fill tools. I've missed some of the parts because they do not really matter.

 

y4z25Lz.png

 

Tns08lh.png

 

AEUGH

 

Texturing is finished. Go to photoshop and make all color variations you want and save them as .png, name them     Vehicles_[vehicle name]_

Vehicle name mustn't containt spaces

These are color palettes of my car:

 

o2t7Hu7.png

 

Now you have to export your vehicle body and wheel models. Copy them to an empty scene and save as separate file. 

If you used blender default orientations (front, back, right, left, top), then rotate the car on Z axis by 180 degrees. Game rotates it for some reason, so you'll have to do it.

Now position everything in scene like this and continue to export settings.

 

SmzFc8s.png

 

Export body and wheel separately with these settings:

 

pJOEkNf.png

 

STAGE 5 - Packing files in folders

 

The folder hierarchy and naming the files you can find in Ringo's guide. The mod file and all of my project files you will be able to download in the end of this topic.

 

make up an Id name for your car. It has to be short, but unique and do not contain spaces. For this car I use '60falcon'.

_____________________________________________

workshop.txt

properties of the mod for Steam Workshop

 

b0eOBur.png

_____________________________________________

mod.info

properties of the mod for in-game mod menu

 

rVTzON3.png

_____________________________________________

models_X folder -> vehicles

this folder contains 3d meshes of the vehicle - body and wheel

ivaQUdY.png

_____________________________________________

textures -> vehicles

easy to guess, all vehicle textures are placed here

null.png - completely transparent image, used as placeholder later on

Ef1QHd7.png

_____________________________________________

scripts -> vehicles

there shoud be a .txt file named with you vehicle's ID name.

9thQAJ0.png

Open it up and follow these instructions:

zqFoJoO.png

 

e8e6XNj.png

change invertX to 'TRUE' if vehicle appears to be mirrored by left and right in game.

1GlvXVI.png

 

e0by8ez.png

Do not care about scale, offset and other geometric parameters.

 

Insert all your color variation textures as shown below:

ifjKUgZ.png

 

7f54h2f.png

 

All vehicle driving parameters are self-explanatory. Remember to set seats count, I'm creating a car with 4 seats.

If you want to make less seats or add new, delete passenger[Seat code] records or add new.

Also remember Seat[position] records down below.

Add or delete the templates, loaded from Game default files:

0QUoQmJ.png

 

ttuEOZk.png

_____________________________________________

LUA SCRIPTS

 

lua -> server -> vehicles -> [car id name]dis.lua

 

Vehicle trunk type distribution file. There is a file with all vehicle distribution types in game files, I'll put it in project folder in the end if the article.

This is game files distibution types, select one of them in respect to the vehicle type you are creating.

 

rrdbwW9.png

 

I'll use CarNormal type for Ford Falcon. This is what distribution lua file has to be:

 

gkOkBRL.png

 

_____________________________________________

 

lua -> shared -> [car id name]SpawnList.lua

 

This file describes spawn zones of your car in game world with certain chance. I've typed in all default zones of spawn, you just have to change the chance and

set [Base.60falcon]

to [Base.(your car id name)]

 

_____________________________________________

lua -> shared -> Translate -> EN -> IG_UI_EN.txt

 

13fKxQ7.png

 

This is the name of the car in UI - keys name, mechanics window name and such.

 

STAGE 6 - In-game editing and tests

 

Launch PZ and disable all mod exept the one you will be debugging. Now close the game and go to Steam. In application setting set startup parameter to -debug

It enables many debug options in-game.

 

Now launch the Game again and, if menu doesn't appear, you've done something wrong in lua scripts. Check them for probles, and I hope, you'll figure out what is wrong.

Now start a new game in world with no zombies and big amount of cars. 

Leave the house and find any car vibing in the street. Right click, -> Vehicle -> Set Script -> [your car ID name]. Car will switch to yours.

This is what I've got on first time in-game spawning:

 

ldi9YJu.png

 

YEET, it is all coming along. But wheel positions are a bit off, and we have to place the entering areas of doors. Go to Right click on car -> [DEBUG] Vehicle -> Vehicle Editor.

 

B1sPbEF.png

 

Chassis

 

Place extents and physics shape to outline the car

 

Areas

 

These are access areas to different parts of the car. There is nothing to describe, really, just place them where you can explain it and continue to next section

 

7yMUj6C.png

 

 

 

 

vIaUxsf.png

 

Right click in mechanics tab to enable cheat options for the car. Now right click in mechanics panel. Here you can get key for that car or repair it. 

 

Final result in different variations

 

eydaj6l.png

VBDXIgf.png

uWR9QJO.png

 

Make a suitable preview image for your mod and crop it in Photoshop to 256x256. Place it in mod folder as preview.png

 

In game menu go WORKSHOP -> create or update mod -> 

pGbTpgO.png

 

Go to your profile workshop items and find the new mod.

TcLOsNJ.png

 

Add the description, more screenshots and set visibility to 'Public'

 

ALL PROJECT FILES: *YEET*

 

 

ZE END

Congratulations if you followed my guide to this point.

 

Comment any issues or mistakes I've made.

 

 

 

 

 

Edited by tubetarakan

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...