Track Creation Guide

From PiBoSo Documentation
Jump to navigation Jump to search
The model must be converted from an fbx file using FBX2EDF or exported from 3DSMAX (up to version 2010).
3 different skydome models are required (in separate .edf files): clear sky, cloudy sky, rainy sky.
1 background model, if desired.


Naming

You must name the objects in a certain way for them to be physically collidable (material names are irrelevant).

The terrain objects the bike can collide with ( asphalt, grass, kerbs, etc... ) must have the TRK prefix followed by the material code ( eg: TRKASPH ):

  • asphalt -> ASPH (Use this for main track surface)
  • asphalt 2 -> BASPH (Same as ASPH, but slightly less grip)
  • asphalt 3 -> CASPH (Slightly less grip than BASPH)
  • grass -> GRAS
  • concrete -> CONC
  • kerb -> KERB
  • sand -> SAND
  • soil -> SOIL
  • paint -> LINE (Use for lines at edges of track and painted asphalt, less grip than tarmac, especially with wet)
  • artificial turf -> TURF


Wall objects the vehicles can collide with must have the WLL prefix, followed by the material code ( eg: WLLCONC ):

  • concrete -> CONC
  • wire fences -> WIRE
  • tyres -> TYRE
  • armco -> ARMC
  • haybale -> HAYB
  • plastic -> PLAS


To identify surfaces an additional prefix must be added to asphalt/concrete objects name ( eg: PIT_TRKASPH ):

  • pit entrance -> PITIN_
  • pit exit -> PITOUT_
  • pit lane -> PIT_
  • non-racing -> OFF_


Groove and skid objects laying over terrain must have SKIDS prefix. This prevents them from casting shadows, and also makes them non-collidable.

All paints ( eg: starting grid, start/finish line, pit lines, ... ) lying on track surface must have DECAL_ prefix.

By default only TRK and WLL objects will receive shadows. To force an object as shadows receiver use the SHAD_ prefix (useful for parts of the track which are visible but not drivable).

To make an object invisible ( but still collidable ) its name must include the keyword INVISIBLE ( eg: WLLCONCINVISIBLE )

The crowds must have the CROWD prefix

Note: having a single object ( eg: TRKASPH ) or 10.000 ( eg: TRKASPH0000, TRKASPH0001, TRKASPH0002, TRKASPH0003, ... ) is exactly the same, performance-wise.

Textures

Supported texture formats:

  • truecolor TGA
  • truecolor BMP
  • DXT1, DXT3 or DXT5 DDS

Every texture must have power of 2 (eg: 256, 512, 1024, 2048) dimensions. They can be rectangular (eg: 32x128)

Transparent Textures

Textures with alpha channels will appear transparent. Alpha channels with only 2 values (0 and 255) are automatically treated as color-key. It's also possible to force it using the prefix CK_ in the texture name (eg: CK_TREE.TGA)

Trees leafs should have the TREE string inside the name (eg: CK_TREE.TGA); this will give the leaves less harsh shading and appear more natural.

Tyre Mark Overlay

For tyre marks, a second texture can be defined using Opacity channel (in Blender: Alpha) and a secondary UV mapping. Textures without an alpha channel will be drawn with multiply blending (good for tyre marks and baked AO), while ones with an alpha channel will be drawn with alpha blending.

If using FBX2EDF, the second UV channel must be named the same as the overlay texture. For instance in Blender: Blender uv channels.jpg

Wet Track Reflections

For rain puddles (track reflections) a third texture can be set in the Specular channel, and a secondary UV mapping. The alpha channel is used to define puddles on wet surfaces (asphalt and concrete).

FLG files

It is possible to change texture parameters creating a text file with the same name of the texture and extension FLG ( and placed in the same directory ).

Available flags:

clampu = 1 ; disables repetitions along U direction
clampv = 1 ; disables repetitions along V direction
nocompress = 1 ; the texture will not be compressed at load time ( use it WISELY )

Shaders

Shaders are linked to textures. To apply a shader to a texture, create a text file with extensions SHD in the same directory and the same name of the texture file.

Specular Maps

Specular map must be in alpha channel of normal map. If specular only is required, specular must still be in alpha channel.

An example shader file that uses specular map only:

specular
{
map = specular_map.tga
shininess = 6
}


Normal Maps

An example shader file that uses a normal map:

bump
{
map = normal_map.tga
}
specular
{       
shininess = 6
}


It's possible to set the normal map tiling by setting repetitions:

bump
{
map = normal_map.tga
repetitions = 10
}


Reflections

Realtime reflections are not supported on tracks. However, you can use a static cubic reflection map:

An example shader that uses a static cubic reflection:

reflection
{
factormin = 0
factormax = 0.9
factorexp = 1.2
envmap = env.tga
}
factormin : The minimum amount of reflection (looking directly towards the surface)
factormax : The maximum amount of reflection (as the viewing angle to the surface increases, reflection will get stronger)
factorexp : The falloff curve between min and max
envmap :

env.tga is a code that sets base.extension. The loaded files then are:

env_back.tga
env_bottom.tga
env_front.tga
env_left.tga
env_right.tga
env_top.tga

All faces must be square and have the same size.


It is possible to set

envmap_add = 1

to enable "add" reflection.


An example shader that combines reflections and specular:

specular
{
map = specular_map.tga
shininess = 6
}

reflection
{
factormin = 0
factormax = 0.9
factorexp = 1.2
envmap = env.tga
map = reflection_map.tga
}

Like specular, reflection maps only use the alpha channel.

3D Grass

To enable 3D grass create create a text file with extensions GRS in the same directory and the same name of the texture file.

An example:

max_density = 12
height = 0.15
height_diff = 0.1
width = 0.3
width_diff = 0.03
texture = grass_blades.tga
colormap = grass_color.tga
densitymap = grass_density.tga
height : minimum blades height, in meters
height_diff : random height added
texture : 4 textures with power of 2 size, for the blades of grass, horizontally packed into one ( for example, 4 128x64 textures packed into one 512x64 )
colormap defines the color of the grass blades ( size can and should be lower than the base texture )
densitymap (optional) defines the density of grass blades. Only alpha channel is used. White = max_density, black = no grass.


Starting Lights

Download the Track Lights example files

These files can be used directly in your track, or you can use them as a starting point for you own custom lights.

Each light surface must be mapped with a texture using the following names:

Start red light 1 : Starting_LightR1_Off.tga
Start red light 2 : Starting_LightR2_Off.tga
Start red light 3 : Starting_LightR3_Off.tga
Start red light 4 : Starting_LightR4_Off.tga
Start green lights : Starting_LightG_Off.tga
Pit red light : Pit_LightR_Off.tga
Pit green light : Pit_LightG_Off.tga

A TXT file with the same name of the texture specifies corresponding ON texture.

Texture Animation

It is possible to create a texture animation of a few frames:

  • Create a text file in the same folder and with the same name of the 1st texture, but with extension .TXT ( for example, screen01.txt )
  • Add the name of the other textures of the animations to the TXT file, one texture per line. For example:
screen02.tga
screen03.tga
screen04.tga
screen05.tga
  • Export the MAP file
  • Create another text file, in the same folder and with the same name of the MAP file, but with extension .SCR
  • For each animated texture, add the following structure:
texture0
{
name = screen01
loop_time = 200
}

where name is the name of the base texture ( without the extension ), and loop_time is the length of the animation, in milliseconds.


Notes

Walls must lay ( with no lower face ) on the terrain, with no holes.
Walls ( except wire fences ) must always have the correct width and the upper face.
All the objects ( walls, bridges, etc... ) must also have the faces invisible from the track.
The textures with alpha channel should be used carefully; excluding paddock glasses, trees and wire fences all the object should be modelled.
Trees should be modelled in 3D.
Leafs' textures should use the CK_ prefix.
Tyres walls and armcos should have a 3D shape.