racer home

Tracks - surfaces

 

Home Use your favorite 3D editor to create tracks, then import the pieces into TrackEd and drive your own track.


Dolphinity Organiser - free planning, project management and organizing software for all your action lists

 

INTRODUCTION

This document describes how to define track surfaces. These define the physical properties of the surfaces found in the 3D track model.

FILES

Surface definitions are stored in the track's special.ini file, for example: data/tracks/carlswood_nt/special.ini.

SURFACE DEFINITION

This is still done with a text editor, like 'notepad' (or 'vi' on Linux). Open <trackdir>/special.ini. An example list (with just 2 surface types) is displayed below. Surfaces are recognized by texture name patterns. There are basic types which have intrinsic behavior. An example is 'kerb', which makes the wheel tremble when you drive on it. You can declare surfaces by entering a list; 'surf_road' in the example is just a name for the surface, and isn't really used, except that it has to be a unique name in the list.

Important note: the first defined surface will be used for some effects that cannot be related to an explicit surface. For example, if you drive on a generic piece of road but this wasn't explicilty defined, the first surface's 'noise' parameter will be used for the generic pieces of road.

Key Meaning
type Basic surface type. Possible values are 'road' (normal road), 'grass', 'gravel', 'stone', 'water', 'kerb', 'ice', 'snow', 'mud' and 'sand'. These will have automatic features in the future, like gravel particles flying when you drive on gravel. In v0.4.8, kerb surfaces will make the wheel tremble, but not much else is done yet.
subtype No function yet.
forbidden If set to 1, this surface is not part of the general driving area. The default is 0, so everything is ok to drive on. Use this flag in combination with racer.ini's assist.time_allowed_offroad to automatically reset a car to the road if he's driving offroad. v0.8.29+
grip_factor

indicates the amount of grip (where 1 is the standard road friction, values <1 mean less grip, >2 means more grip). Note that 'grip_factor' is NOT the friction coefficient, but a scaling factor.

grip_decline_driveline (v0.8.21+) Determines how much the grip decreases as you move off the driving line. A value above 0 will have an effect on grip as the car deviates from the driving line. TO BE ELABORATED!
rolling_resistance_factor

indicates the scaling of tire rolling resistance (for instance, grass has less friction, but MORE rolling resistance). In the car.ini file, you define a rolling_coeff for the tire; this factor effectively scales that parameter. In short:

rollResistanceForce = tire.rollingCoeff*load
rollResistanceTorque = rollResistanceForce*wheelRadius*surface.rolling_resistance_factor

A more elaborate description of rolling resistance forces can be found here.

road_noise (factor)

Amount of noise/rumble. This is used to actually modify the surface height (so the wheels really bop up & down). Defaults to 0 for a silky smooth surface. The amount filled in here is actually the maximum offset (in meters) added to the polygon/spline surface height. Nice values probably range from just above 0 to about 0.05, where 0.05 (5 cm) is quite a rough surface.

For kerb surfaces (type=kerb), this actually gives the kerb height. No noise is applied, but an up/down surface height modification is applied with the maximum offset being road_noise.

road_noise_frequency (Hz)

Upto 4 frequencies of road noise may be specified. A typical entry would be '0.25 32' for example for low-oscillating noise with high-frequency road noise on top. Note that Racer uses Perlin noise; this is non-random noise which looks like a randomly amplified sine function.

Example: road_noise_frequency=0.25 32

road_noise_amplitude (m) Gives the amplitudes of the frequencies above. Typical for the above example might be: 1.0 0.1. Normally the lower frequencies have larger amplitudes than the higher frequencies.
road_noise_threshold A threshold value before the amplitude really becomes active. Say you have a road that is mostly flat, but with bumps every now & then. By raising the threshold you can flatten out smaller bumps, meaning you're left with only the bumps that exceed a certain value. An example would be road_noise_threshold=0.5 0, which in this example would mean that only if the noise value rises above 0.5 (for the low frequency part), the noise will be used. Also, it doesn't do this to do the higher frequency (the '0' value).
Do note that the bumps get lower in this case, since 1.0-0.5 = 0.5 will be the highest noise value you can obtain. Note that this is then a threshold value, so a subtraction of the noise signal, and not a factor (which would be multiplication).
steer_noise (Nm) Next to road_noise, which is a physical modification of the surface height, you can add some steering force feedback. This is purely for effect; if you use road_noise=0 and steer_noise=2 for example, the wheels will not physically move, but you will FEEL the force feedback. In other words, it is best to mix road_noise which is not harsh, then add steering impression through steer_noise.
Defaults to 0 for smooth steering. The value is in Nm (Newton-meters); a value of 1 is quite ok to get some effect (since v0.5.2); consider 10 Nm as a very large steering torque.
dust_color The color of dust (smoke) that comes of this surface, represented by 3 floating point numbers, each ranging from 0..1 (RGB). For example 'dust_color=0.68 0.49 0.1' gives the particles a brown color.
skidmark If set to 1, enables skidmark generation on this surface. May set this to 0 for some surfaces (v0.5.3 b3.0+).
skid_sound Defaults to 1, meaning skids are produced. If set to 0, the skid sound is not played while on this surface.
pattern indicates the texture names which constitute this surface type. The list is processed in order, so for the example below, first all surfaces are declared road, then the subset ('dirt*') is declared to be dirt. Patterns can use '*' and '?', so 'road*' matches 'roadkill', 'road1' and 'road' for example, while 'road?' will only recognize 'road1' from the aforementioned list.
viscosity A number roughly between 0 and 1, giving the 'liquidness' of the surface. Try 0.1 for starters for gravel. Viscous surfaces generates forces depending on the vehicle velocity, emulating gravel/grass type surfaces where it's impossible to drive fast.
audio Added in Racer v0.9.0 RC5, this defines a specific track-relative sample set to use when wheels touch this surface. This gives you the option to define per-track sounds, and per surface. When not specified, a global sound (from data/audio) is played, based on the 'type' above. See the example surface below for the layout (which is mostly the same as for car sounds; engine mixing for example).

Take care not to mix images that contain surfaces of different types (say, a texture which contains both a piece of road and a piece of grass), as you'll not be able to distinguish between them in Racer's surface detection scheme. Usually, this isn't a problem.

surfaces
{
  surf_road
  {
    type=road
    subtype=0
    grip_factor=1
    rolling_resistance_factor=1
    road_noise=0.02
    road_noise_frequency=0.25 32
    road_noise_amplitude=1.0 0.1
    road_noise_threshold=0.5 0
    pattern=*
    audio
{
; Master volume for this set
volume=1
; Pitch variation, based on car velocity
pitch_scale=0.005
pitch_offset=1.0
; Samples in this set
smp0
{
; All engine samples depend on engine RPM
sample=road_rumble.wav
min=0
max=100
attack=0
decay=0
; Base pitch of used sample
natural=1
}
} } surf_dirt { type=sand subtype=0 grip_factor=0.5 rolling_resistance_factor=5 pattern=dirt* skidmark=0 skid_sound=0 dust_color=0.68 0.49 0.1 ; Audio will just be the default sample for 'sand' } }

 


Dolphinity Organiser - free planning, project management and organizing software for all your action lists

(last updated December 19, 2014 )