Car modeling tips and remarks.
To model a car from start requires weeks of work and good knowledge of modeling techniques and how to do it.
Modifying an existing car (e.g. extending its quality) is much easier.
There are already pretty good car models, available on blendswap.
See our forum topic, this post shows the list of cars.
Some are too high poly or too low. And some just don't fit the game.
The license for the art must be GPL, CC-BY-SA, CC-BY, CC0, etc so we could use it.
They still require some work (to have in game):
We are using and recommend Blender to do all of the modeling tasks.
At least basic knowledge of Blender is required.
There are several good resources on internet to learn it.
Things to keep in mind when modeling (required by game):
Keep resonable triangles count (faces, polygons). You can see it in top bar in Blender.
For good looking car, total of 50 000 triangles would be required, let's say up to 100 000.
One wheel (including brake disc and caliper) should be about 4 000 triangles.
See Example at bottom of page and Comments for more info.
More detail can (and should) be put in textures. More triangles will unnecessary reduce game Fps.
Also Normal map and Ambient Occlusion map can be baked in Blender.
This is usually difficult and time consuming. Normalmap is generated from high poly model.
Ambient occlusion is easier and gives good feeling.
Make as much detail as possible, but check out other cars.
ES car is the best here, it has a lot of detail, but some of it is baked in normal map.
To check geometry (triangles) just start game and press F10 to toggle wireframe.
Since version 2.0 game logs car meshes info in ogre.log (how to find it in Paths wiki).
Look for “MESH info: ” it says how many submeshes (subs, materials) and how many triangles (tris) each part has and the total amounts.
ES car is best because it only has 1 submesh and 1 material in each .mesh file. This is most optimal and preferred.
Keep in mind that faces in blender can be two sided, but in game are one sided.
Thus the face normals (in blender) must be flipped to proper side. They won't be visible in game if on the other side.
Cars (just like tracks) aren't big in size.
ES is biggest and after export the Ogre, all .mesh files are about 1MB, and all textures 5MB.
It's best to keep the size not higher than that.
We have git repository with .blend files of some cars
https://github.com/stuntrally/blendfiles/tree/master/cars
The best and most complicated is ES, it has high poly model and baking normalmap and ambient occlusion was done for it.
S8 and XZ are good, they have a simple unwrap and interior.
Note: replace ES with the in-game car name you work with.
Name the body parts (and the geometries): ES_body, ES_interior, ES_glass.
If you have a wheel then use: ES_wheel. ES_brake for brake disc and caliper (not necessary).
Car gets exported to such meshes:
This makes the exported files already named properly for game, so just copying there works.
(We use such short names, simply because it is not possible to use original car names).
This Blender screenshot shows (for XZ car):
A finished interior with good UV map would look similar to this (for ES car):
Exporting models from Blender to Ogre (see Objects Wiki on how to install exporter) is done from menu File|Export|Ogre3D.
From the exporter options pick axes as “xz-y”, use tangents (mark checked), uncheck edges-list (we don't need them).
If succesfull, you will find files in the selected folder (1 mesh file in xml format and 1 binary mesh fie) for each selected geometry in blender.
Copy the binary .mesh files (parts) into the data/cars/ES dir in Stunt Rally (replacing the older/original ones).
Start Stunt Rally and check how it looks.
Name all materials in Blender with car prefix, e.g. ES_body, ES_glass, ES_interior, ES_wheel, etc.
Keep the material count at minimum. This is crucial.
We can't have each car part like front/rear lamps, seats, steering wheel etc as separate parts, they must be on 1 mesh (geometry) and have UV mapped to different parts of texture.
It is best to have each body part with 1 material, with the same name as geometry (ES_interior, ES_glass etc).
(Each material represents new batch (draw call) and parameter changes which reduces game Fps).
So, join (Ctrl-J) all geometry in interior. Mark seams on edges that will get cut. Unwrap (U) parts.
Use UV editor to move and scale parts to according places on texture. Don't make parts overlap on texture.
Use bigger scale for parts that require more texturing (detail).
In game we can use:
Desired file structure in data/cars/3S (for already exported car).
3S_body.mesh
3S_interior.mesh
3S_glass.mesh
3S_wheel.mesh
3S_brake.mesh
Those files were already described.
about.txt - Contains info of the model, credits, changes.
description.txt - This text file contains the info text which is displayed in game. It has general info about the car and how it handles in game.
engine.wav - The engine sound file (at 7000 rpm). Must be wav and 44100 Hz, mono or stereo 16-bit.
3S_body00_red.png - Main body texture. It has to be colored in saturated red, because it will change depending on car paint chosen in game. Can just be whole red texture at start of car creation.
3S_body00_add.png - Old version cars used this to add detail to red texture. Can be full transparent at start.
3S_body00_brake.png - Same as add but with rear brakes lit. The texture add is replaced to brake when car brake is on.
3S_interior.png - interior texture (with various car parts mapped too) possibly with 3S_interior_normal.jpg.
3S_glass.png - the transparent glass texture (usually small)
optional: 3S_spec.png, 3S_refl.png - to map specular parts and reflection, or deny them on matte parts.
3S_Tire.png, 3S_Tire_norm.png - diffuse and normal texture for tire model
Materials for all cars are defined in data/materials/cars.mat
(thanks to shiny material generator its syntax is simple while materials are powerful)
A very basic example for 3S, you can comment out lines with //.
material car_body_3S
{
parent car_body
specMap 3S_spec.png
}
material 3S_glass
{
parent car_glass2
diffuseMap 3S_glass.png
}
material 3S_interior
{
parent car_interior
diffuseMap 3S_interior.png
}
material 3S_wheel
{
parent car_wheel
diffuseMap 3S_wheel.png
}
More complicated example for ES wheel
material ES_wheel
{
parent car_wheel
diffuseMap ES_wheel.png
normalMap ES_wheel_normal.jpg
specMap ES_wheel_spec.png
reflMap ES_wheel_spec.png
}
Another for XZ wheel
material XZ_wheel_chrome // rim
{
parent car_base
diffuseMap XZ_Tire.png
ambient 0.1 0.1 0.1
diffuse 0.1 0.1 0.1
specular 1 1 1 4
env_map true
fresnel true
fresnelScaleBiasPower 0.6 0.15 4
}
No car is perfect, and every one has some smaller or bigger issues.
I describe here what could be done to improve those cars. They were released in version 2.0 (with those issues).
BTW. We are looking for artists who could improve cars (use IRC or Forum to contact us if you want to help).
The ALL (total) counts are computed as sum of body, interior, glass and 4 times wheel and brake.
As mentioned few times this car is nearly perfect. It has also taken a lot of time to do, and to transform all the detail from high poly version to low poly with details placed on textures, and baked maps.
The dashboard is so good it could actually be used for in car camera view. This is the only car that can be driven so, rest is not done at all.
Only thing to improve would be to reduce the interior faces count (tri), since its 2x more than body and you mostly see body in game.
Also, since normal map was baked, it introduced a distortion, seen on body, from close. It is not so smooth as without it, and those are errors from baking. Thus I don't recommend normalmap baking, just ambient occlusion.
Brake.mesh tri count is also too high.
You can see the lines in wireframe are quite dense.
ES_body.mesh sub: 1 tri: 19.0k ES_interior.mesh sub: 1 tri: 38.0k ES_glass.mesh sub: 1 tri: 1.0k ES_wheel.mesh sub: 1 tri: 4.1k ES_brake.mesh sub: 1 tri: 3.1k ES ALL sub: 11 tri: 86.9k
S1 has very good textured interior, with very low tri count and still looks good. In car camera view is ok.
But it has far too many submeshes (sub) on body, interior and wheel. This needs to be reduced, and all parts merged to 1 uv space, and textures combined to 1.
As you can see on wireframe body and interior lines show low poly count.
S1_body.mesh sub: 4 tri: 12.0k S1_interior.mesh sub: 12 tri: 8.6k S1_glass.mesh sub: 1 tri: 0.5k S1_wheel.mesh sub: 3 tri: 3.9k S1_brake.mesh sub: 1 tri: 3.1k S1 ALL sub: 33 tri: 49.4k
S8 has extremely high sub and tri counts (far too many faces). It needs all interior parts merged into 1 mesh and 1 material and uv unwrap (Done).
Also some triangle reduction is necessary (at least by half), be sure there is no Subdivision applied, and use Decimation modifier if necessary.
S8_body.mesh sub: 1 tri: 43.0k S8_interior.mesh sub: 16 tri: 82.0k S8_glass.mesh sub: 3 tri: 16.8k S8_wheel.mesh sub: 2 tri: 3.9k S8_brake.mesh sub: 1 tri: 3.1k S8 ALL sub: 32 tri: 169.9k
This car has very smooth body with good tri count.
Interior was made by me and thus is rather poor. I copied seats from S8, and made the rest of interior by extruding 1 line and adjusting it. It has also poor texturing there.
But still it's an interior and better than none (the original model didn't have it).
Next thing is that the body has holes. They are visible from close. It is needed to add triangles to interior which would be dark and would cover those holes.
Also ALL sub count is much too high, mostly because of wheel and brake not having 1 submesh, and also interior not merged. Next, wheel rim has too many faces (about 2x more) but I left it so since decimation can produce unwanted distortion to mesh.
XZ_body.mesh sub: 2 tri: 22.0k XZ_interior.mesh sub: 6 tri: 19.6k XZ_glass.mesh sub: 1 tri: 1.0k XZ_wheel.mesh sub: 3 tri: 11.4k XZ_brake.mesh sub: 2 tri: 0.7k XZ ALL sub: 29 tri: 91.3k
Like with many cars, roof and door frames are gone, when seen from car outside (or from down left to upper part of car). Need to add more interior faces there. Shown here:
This happens because faces are 1 sided in game. When adding the second, interior faces, keep high distance, because if it is too low shadows are blinking on those parts.