Track Creation Rules

From PiBoSo Documentation
Revision as of 10:28, 14 April 2016 by PiBoSo (Talk | contribs) (Textures)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
The model must be 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


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)

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

Trees leafs must have the TREE string inside the name (eg: CK_TREE.TGA)

For tyre marks, a second texture can be defined using Opacity channel and a secondary UV mapping. Textures with alpha channel will be drawn with alpha blending, while ones without alpha channel will be drawn with multiply blending.

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

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 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 a normal map:

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

An example shader file that uses specular map only:

specular
{
map = specular_map.tga
shininess = 6
}

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
}

Reflection map only uses 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

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


Then a TXT file must be created with the same name of the texture ( and placed in the same directory ), with the name of the ON texture in the first line.


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.