World Racing 2

World Racing 2

Not enough ratings
Creating Scalable Templates & Ambient Occlusion Maps
By kilésengati
Guide for creating SVG templates and ambient occlusion (AO) maps using Blender, for use in vector- and pixel-based image edition software.
   
Award
Favorite
Favorited
Unfavorite
A) Introduction
G'day everyone,

this guide will show you how to create vector templates and high-resolution AO maps for assets in WR2 among other games made by Synetic.

Having SVG templates and high-resolution AO maps is useful when creating liveries for existing and new vehicles.

This workflow allows you to create crisp and infinitely scalable liveries for your favourite vehicles.

Make sure to backup your game files!
B) Legal
THE TUTORIAL IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE TUTORIAL OR THE USE OR OTHER DEALINGS OF THE TUTORIAL.
C) ¡¡CRUCIAL ADVICE!!
Please stop messing up your brains with short-form media and content delivery systems.

Read this guide thoroughly, then think about it critically.
Read it again, then think again. Be patient.

Also: Making errors is part of the learning process. Never give up!


If by then you still haven't figured out what to do, feel free to ask any questions.
0) Prerequisites
You'll need:

A computer running Windows or Linux.

For Linux: A decent WINE environment.

NOTICE: For any Linux-related stuff, please refer to the respective tutorials elsewhere.


Krom's WR Toolkit[github.com]:
MTKit
PTXTool


Blender[www.blender.org]:
LWO Import-Export Addon[github.com] (More on that later!)

Blender is also available on Steam:
https://steamhost.cn/app/365670/Blender/


ATTENTION: This tutorial was made with Blender 4.0 in mind. Plug-ins may not work with later versions.


Notepad++[notepad-plus-plus.org] (Windows)
Notepadqq[notepadqq.com] (Linux)


Inkscape[inkscape.org]


The GIMP[www.gimp.org] (in case you can't work with vector graphics)


For hand-drawn artworks, I can also highly recommend:

Krita[krita.org]

Krita is also available on Steam in exchange for a donation:
https://steamhost.cn/app/280680/Krita/


For more suggestions on media production software, feel free to visit my guide on:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2940286718


NOTICE: For installation of software and add-ons, please refer to the product-specific support pages.
1) Export MOX to LWO
Open the car model in MTKit and export MOX to LWO.

Example using a model from the original World Racing 2, but this works for WR2CE as well.

ATTENTION: Export it to a different directory than the car, to avoid conflict with the existing MTL.


When you are prompted on whether parts should be spread, select "No".

2) Import LWO to Blender
For importing LWO files to Blender, you need an add-on capable of such installed.

Now just make a new file, clean the scene (A + X + Enter) and import the LWO you've previously exported with MTKIt.

Unfortunately, unless you have unpacked all textures and put them in the right place, you'll receive an error message prompting you about missing textures. To solve this,...


Modifying the LWO-I/O add-on.

... go to your addons directory of Blender. The usual paths are...

Windows:
%USERPROFILE%\AppData\Roaming\Blender Foundation\Blender\[Blender version number]\scripts\addons\io_scene_lwo

Windows (Steam):
[Path to Steam]\steamapps\common\Blender\[Blender version number]\scripts\addons\io_scene_lwo

Linux:
$HOME/.config/blender/[Blender version number]/scripts/addons/io_scene_lwo


Open "lwoObject.py" with Notepad++ and comment-out line 1169-1173 with an hash (#).

The finished section should look something like this:


Left: Edited result; Right: Original.

Save the PY-file and restart Blender.
Now you should be able to import the LWO file.


3) Create the Template
Now that you have imported the model, select it and TAB into edit-mode.

Now select the livery material, with the name and colour corresponding to the one in MTKit, from the material list (usually 0100) and click the "Select" button to select all verticies assigned to the material.

-

With all you need selected, switch to the "UV Editing" tab.

-

Now box-select all verticies in the UV editing window on the left.

-

Select "Export UV Layout" in the "UV" drop-down menu.

-

Choose SVG.
Resolution can be kept the same or multiplied, if you wish to.
4) Working with SVG Templates
Just fire-up Inkscape or a vector-editing program of your choice, load the SVG and go ham.

Make sure to group the template first though, or you'll have a nice day sorting everything out later!

-

What's really nice about these templates: You can snap to the UV map's geometry and create perfect cuts in the livery around the edges doing so. Also they are infinitely scalable.

Sometimes, physical geometry is represented as zero-width geometry in the UV map. In this case, you have to choose a higher resolution and draw a line on the zero-width geometry with the colour you wish the real geometry to have. You gotta get a bit creative there and experiment.

Either that, or you have to remap the entire thing for all real geometry to be represented properly in the UV map.

If you choose to import the SVG into a pixel-based editing program like The GIMP, you'll lose all the advantages of vector graphics, but the template should still be useable.

-
-
-
-
-
-
-
-
-
-
-

Have fun, but since we are already here, we might as well bake an high-resolution AO map that will go nicely with your high-resolution livery...
5) BONUS #1: Baking Ambient Occlusion
Switch to the "Shading" tab.

Make sure you have opened the correct material in the shader editor.

Set the "Base Colour" of the "Principled BSDF" shader to white (Hex: #FFFFFF)

-




Add a "Texture Coordinate" node.

-

Add an "Image Texture" node.

-



Create an image at a resolution the same or multiple of the original texture with a grey base colour. (Burger Menu ≡ > Image > New)
Usually I use #AFAFAF, but they may vary from model to model.

Note: You should create a new image for each baking attempt.

Textures for videogames ideally have dimensions of x^2.

-

Then connect "Texture Coordinate > UV" to "Image Texture > Vector" in the node editor.




Select that texture in the image texture node and switch rendering to "Cycles" in the sidebar.

Scroll down to "Bake" and set the "Bake Type" to "Ambient Occlusion".

-



Feel free to experiment with the "Margin Type" and "Size".

Unmark the "Clear Image" option.

Before baking, adjust the render settings to your liking. If you have a GPU, using that for rendering is usually faster than the CPU. Also lowering the sample rate and enabling denoising helps speeding up the process without sacrificing quality too much.

Select the object you want to bake (the car) and hit the "Bake" button.

-



Done? Far from!

See those weird shadows?

Those are because some detachable parts get too close to the main model.
On top, this particular model has some really bad geometry errors.
Same with the WR2CE model:

-

Fortunately, in this case, it can be fixed for our purposes in just a few steps!




Switch to edit mode once more and select all verticies related to the livery material again. Then separate the mesh either by selection (alternatively material) from the rest of the model.

-




For this model, you now have to manually separate the mirrors and the spoiler as well, as otherwise, there would be ugly shadows left behind when they break off in-game.

That's a wee fiddly. I find using the wireframe mode (press Z, then select "Wireframe") and orthogonal views (Numpad) to be helpful.

Seperate them, but don't delete them just yet, we want to bake their AO map, too.

-




Now add a large plane underneath the car, at about the distance where the wheels would touch the ground. We need that to get some ground AO on the model.

Select "Add > Mesh > Plane" in the 3D view.

-

For Synetic's models, I usually find a size of 20 m x 20 m and a world position of Z -0,3 m — -0,4 m useful.




Only enable the livery mesh for rendering (the camera icon).

-

Bake and save. Do the same for the mirrors and spoiler. Bake and save. Done.

-




Beaut! Freshly-baked textures. Smells good, eh?

-

There are still some imperfections within the model that become blatantly obvious in the AO map, but we are not here for fixing the model. However, feel free to do so. :)

Now let's composite everything...
6) BONUS #2: Compositing Liveries with AO Maps & Creating PTX Alphas
This section will show you how to combine your baked AO maps with your liveries and create PTX alpha maps from them, yielding amazing looking results; adding the cherry on top of your already crisp livery create with the previously made SVG template.

TBC