There seems to be a demand for this kind of thing, so here you go. Thread's a work in progress and all that.
Broadly there are two types of content that need to be updated. Cars and tracks. These share some features in common - shaders, textures, dofs are all similar. Both dump errors into the QLOG.txt. They also have some unique features - the .ini files controlling them are quite different, though they follow the same structure. I'll start by covering the shared features, then move to car and track specific updates.
Racer.nl does, of course, have documentation - so where possible I'll link to the relevant pages. A lot of it supposes you're creating new content, though, or already understand how everything works. This thread will be more limited in scope, focusing on content that already works in an older version, and making it work better in new ones.
If I'm missing a step, or you know an easier way to do anything, I'd be glad to add that.
Table of Contents
So let's get started.
First things first: File formats.
.ini, .crv and .shd are text formats. Open them in your text editor of choice - I can recommend NotePad++.
- these follow a standard structure of nested brackets. Comments are preceded by semicolon ; like this.
.dof is a 3d object format. Modeler.exe, which comes with Racer, can open them.
.ar contains protected 3d objects. Normal users have no way to retrieve them, but Racer can still read them.
.tga, .dds, .bmp, .jpg are image formats. Photoshop, GIMP, etc. should be able to open them. You'll probably need to search for plugins in order to handle .dds (insert links here).
.wav and .mp3 are audio formats. Audacity is a decent free audio editor, though you probably won't need to edit these.
Next, what are you working with? Open up car.ini or track.ini. Near the head, you'll see version=. Some update tips may be more relevant to particular versions - very old ones (05b) may not even come with shaders. If you have a question, this piece of information can be invaluable in getting useful advice. If the car comes with a readme.txt, it'll most likely contain some useful information, such as author contact info. It may be worth contacting them to see if they or someone else is already working on updating the content - that'll save time.
1. Car/Track Common Files
This section applies approximately equally to both cars and tracks.
- .dof files
- textures
- shaders
1.1 .dof Files
Unlikely to be a problem.
Some will have QLOG errors telling you the model has problems. If so, copy the relevant dofs, along with dof_fix.exe, cg.dll, cgGL.dll (from the main Racer folder) into a seperate folder. I'd suggest C:\_DOF\. Open up a command prompt (Start -> Run cmd.exe) and change directory (cd) where you want to go. For example, if you put them in C:\_DOF, you would write cd C:\_DOF in the command line. Once there, you just input dof_fix filename.dof, and it will fix the problem for you.
You can also view .dof files by running Racer/modeler.exe. Once open, you can check the appearance of the object, as well as the materials it uses - use PgUp/PgDn to switch between materials and you can see their names, as well as having them highlighted on the model. The material tab will let you adjust some values, but the only useful one is the material name.
1.2 Textures
May be a problem.
The main issue here will be alpha transparency. In old versions of Racer, it was possible to reverse the alpha channel. This is no longer the case. If transparency appears backwards ingame (solid where it should be clear, clear where it should be solid) this is likely the cause. If it is a problem, open up the texture in your image editor, and invert the alpha channel (likely to be called something like Colors > Invert).
1.3 Shaders
Always a problem.
Old shaders simply use a visually similar, but incompatible format. This is the reason old content uniformly looks wrong when you load it up.
See:
Old shader documentation on Racer.nl.
New shader documentation on racer.nl.
For a quick conversion, you can just replace each shader with its modern equivalent. This is what I'll focus on - what the old shader looks like, what the new one looks like.
Shaders share more values between materials now, so a common simplification is to write the fragment and vertex shaders (yes, this terminology is confused - they are a different kind of shader) into the top of the material shader. To facilitate the transition, I'll include the most commonly used ones here with a brief description of what each looks like. After that, I'll show a 1:1 correspondence between old shader and new shader, referring back to the common values.
1.3.1 Vertex & Fragment Shaders
These vary slightly between car and track materials, but the difference is simple: An object that can move, such as a car, uses the dyn_ prefix on a vertex/fragment shader (if it exists). An object that can't move, such as the terrain, does not have the dyn_ prefix. I will write these assuming all models can move - you can delete this feature from track materials, creating slightly more efficient versions.
You can include all of these at the top of your .shd file, or limit it to the ones you use. These will be referred to by individual material shaders, and will let you tweak the way groups of materials look at the same time.
This is the basic vehicle shader. Apply this to every material, and it will all be lit correctly, but have nothing fancy - no reflections, no bumpmapping, no transparency. This is the minimum you want every material to have on a car.
Track version of above - dyn_ is removed. This is the simplest shader, period. You can remove dyn_ from other shaders, too - just check that data\renderer\shaders contains the .cg files you refer to.
This adds reflections to the material. If you leave it at this, default settings for Fresnel will be used - the Fresnel curve is the way the material reflects depending on the angle you look at it. The primary texture's alpha channel is used to determine reflectivity - this maintains compatibility with most old cars, but you may have to invert the channel (as discussed above).
A reflective transparent material, such as glass. The primary texture's alpha channel is used to determine transparency. Again, you may need to invert the texture's alpha channel to make it appear correctly.
Bump mapped using a second texture to indicate the texture normals. Also available in combination (eg. dyn_standard_bump_reflect) with other shaders - see references.
1.3.2 Material Shaders
The second half of each shader is the part you need to update: the material sections. Most cars will already have this - each material is described as a section that looks like:
Material will be the name - frequently the same as the texture, eg. body.
To update these, you want to transfer the old settings to a new shader that performs the same function. To this end, I'll try to provide a comprehensive list of shaders. If something's not here, ask about it in the thread.
First up, the basic matte material shader.
Becomes...
Green indicates values that will vary by material, but don't need to be updated. You want to look at the structure outside that to figure out what the material does, then edit it to update. In this case the change is straightforward, add vf_dyn_standard. If this is a track material, you could just use vf_standard.
The reflective car shader. Ubiquitous, and made much easier by the new system.
Or
Becomes...
This is the type of shader most cars will use for the main body texture - reflective, possibly with a fresnel map (first example uses one, second doesn't). I've added a couple more colours here - orange indicates values that may need to be changed, while red indicates values that are definitely out of place. In this case, the specular= value is most likely too high - the newer renderer makes specular bright relative to the sun, which has gotten way brighter. The emission= value was used fairly often in old versions to brighten up cars - it should only be used on materials that actually glow now, and in most cases should be removed. The texture map in the layer0 is the texture map, body.tga, while layer1 contains the reflection map. You can see that in the old fresnel example, the textures appear in a different order.
The transparent glass shader. Tricky to get right, because you have to correctly mix layers together and render them in the right order.
Becomes...
Another colour introduction: blue means values that can be tweaked to personal preference, but are new with the new system. I will try to include reasonable values for these, but a particular situation may need particular changes. Instead of blendfunc=blend, you may want to try blendfunc=dst_alpha one_minus_src_alpha. This will most likely work best with more transparent windows.
For the fresnel section, Cosmo° recommended
These are not massively different, but you can get an idea of what tweaks to try.
1.3.3 Pre-tweaked Shaders
The previously materials cover the majority of what you're going to need, if you just want to transfer old settings over. If the car doesn't come with shaders, you're unsatisfied with how they look, or you're just confused by the settings, there is an alternative. You can choose to use shaders already tweaked to look good. Here are some of those.
A nice glossy paint. Suitable for general usage. Materials will look like:
This is quite simple on the material end of things, because many values are copied from vf_dyn_gloss_paint. So you can just use that shortcut to save having to write stuff out every time.
2. Car Specific Files
2.1 views.ini
Unlikely to be a problem.
2.2 torque.crv
Unlikely to be a problem.
2.3 car.ini
Usually a problem.
See Cosmo°'s post for now.
3. Track Specific Files
3.1 spline.ini
Unlikely to be a problem.
3.2 track.ini
Will need minor updates.
3.3 ai/
Unlikely to be a problem.
3.4 tod/
Entirely new.
3.5 geometry.ini, movables001.ini
Will need minor updates.
3.6 special.ini
Always a problem.
4. QLOG.txt Errors
Likely to be arranged in alphabetical order, or by subject. The final step before sharing your work.
Will continue to add info, sleeping and such for now. Looking for suggestions on organization, formatting, etc. early on so I don't have to change much. Thanks!
Broadly there are two types of content that need to be updated. Cars and tracks. These share some features in common - shaders, textures, dofs are all similar. Both dump errors into the QLOG.txt. They also have some unique features - the .ini files controlling them are quite different, though they follow the same structure. I'll start by covering the shared features, then move to car and track specific updates.
Racer.nl does, of course, have documentation - so where possible I'll link to the relevant pages. A lot of it supposes you're creating new content, though, or already understand how everything works. This thread will be more limited in scope, focusing on content that already works in an older version, and making it work better in new ones.
If I'm missing a step, or you know an easier way to do anything, I'd be glad to add that.
Table of Contents
- Car & Track Common Files
- .dof Files
- Textures
- Shaders
- Vertex & Fragment Shaders
- Material Shaders
- Pre-tweaked Shaders
- Car Specific Files
- views.ini
- torque.crv
- car.ini
- Track Specific Files
- spline.ini
- track.ini
- ai/
- tod/
- geometry.ini, movables001.ini
- special.ini
- QLOG.txt Errors
So let's get started.
First things first: File formats.
.ini, .crv and .shd are text formats. Open them in your text editor of choice - I can recommend NotePad++.
- these follow a standard structure of nested brackets. Comments are preceded by semicolon ; like this.
.dof is a 3d object format. Modeler.exe, which comes with Racer, can open them.
.ar contains protected 3d objects. Normal users have no way to retrieve them, but Racer can still read them.
.tga, .dds, .bmp, .jpg are image formats. Photoshop, GIMP, etc. should be able to open them. You'll probably need to search for plugins in order to handle .dds (insert links here).
.wav and .mp3 are audio formats. Audacity is a decent free audio editor, though you probably won't need to edit these.
Next, what are you working with? Open up car.ini or track.ini. Near the head, you'll see version=. Some update tips may be more relevant to particular versions - very old ones (05b) may not even come with shaders. If you have a question, this piece of information can be invaluable in getting useful advice. If the car comes with a readme.txt, it'll most likely contain some useful information, such as author contact info. It may be worth contacting them to see if they or someone else is already working on updating the content - that'll save time.
1. Car/Track Common Files
This section applies approximately equally to both cars and tracks.
- .dof files
- textures
- shaders
1.1 .dof Files
Unlikely to be a problem.
Some will have QLOG errors telling you the model has problems. If so, copy the relevant dofs, along with dof_fix.exe, cg.dll, cgGL.dll (from the main Racer folder) into a seperate folder. I'd suggest C:\_DOF\. Open up a command prompt (Start -> Run cmd.exe) and change directory (cd) where you want to go. For example, if you put them in C:\_DOF, you would write cd C:\_DOF in the command line. Once there, you just input dof_fix filename.dof, and it will fix the problem for you.
You can also view .dof files by running Racer/modeler.exe. Once open, you can check the appearance of the object, as well as the materials it uses - use PgUp/PgDn to switch between materials and you can see their names, as well as having them highlighted on the model. The material tab will let you adjust some values, but the only useful one is the material name.
1.2 Textures
May be a problem.
The main issue here will be alpha transparency. In old versions of Racer, it was possible to reverse the alpha channel. This is no longer the case. If transparency appears backwards ingame (solid where it should be clear, clear where it should be solid) this is likely the cause. If it is a problem, open up the texture in your image editor, and invert the alpha channel (likely to be called something like Colors > Invert).
1.3 Shaders
Always a problem.
Old shaders simply use a visually similar, but incompatible format. This is the reason old content uniformly looks wrong when you load it up.
See:
Old shader documentation on Racer.nl.
New shader documentation on racer.nl.
For a quick conversion, you can just replace each shader with its modern equivalent. This is what I'll focus on - what the old shader looks like, what the new one looks like.
Shaders share more values between materials now, so a common simplification is to write the fragment and vertex shaders (yes, this terminology is confused - they are a different kind of shader) into the top of the material shader. To facilitate the transition, I'll include the most commonly used ones here with a brief description of what each looks like. After that, I'll show a 1:1 correspondence between old shader and new shader, referring back to the common values.
1.3.1 Vertex & Fragment Shaders
These vary slightly between car and track materials, but the difference is simple: An object that can move, such as a car, uses the dyn_ prefix on a vertex/fragment shader (if it exists). An object that can't move, such as the terrain, does not have the dyn_ prefix. I will write these assuming all models can move - you can delete this feature from track materials, creating slightly more efficient versions.
You can include all of these at the top of your .shd file, or limit it to the ones you use. These will be referred to by individual material shaders, and will let you tweak the way groups of materials look at the same time.
Code:
vf_dyn_standard
{
vertex_shader
{
file=dyn_standard_v.cg
}
fragment_shader
{
file=standard_f.cg
}
}
Code:
vf_standard
{
vertex_shader
{
file=standard_v.cg
}
fragment_shader
{
file=standard_f.cg
}
}
Code:
vf_dyn_reflect
{
; Just reflection
vertex_shader
{
file=dyn_standard_reflect_v.cg
}
fragment_shader
{
file=dyn_standard_reflect_f.cg
}
}
Code:
vf_dyn_reflect_window
{
vertex_shader
{
file=dyn_standard_reflect_window_v.cg
}
fragment_shader
{
file=dyn_standard_reflect_window_f.cg
}
}
Code:
vf_dyn_bump
{
tangents=1
vertex_shader
{
file=dyn_standard_bump_v.cg
}
fragment_shader
{
file=dyn_standard_bump_f.cg
}
}
1.3.2 Material Shaders
The second half of each shader is the part you need to update: the material sections. Most cars will already have this - each material is described as a section that looks like:
Code:
shader_[COLOR=red]material[/COLOR]
{
...
}
To update these, you want to transfer the old settings to a new shader that performs the same function. To this end, I'll try to provide a comprehensive list of shaders. If something's not here, ask about it in the thread.
First up, the basic matte material shader.
Code:
shader_[COLOR=green]grass[/COLOR]
{
cull=back
layer0
{
map=[COLOR=green]grass.tga[/COLOR]
}
}
Code:
shader_[COLOR=green]grass[/COLOR]~vf_dyn_standard
{
cull=back
layer0
{
map=[COLOR=green]grass.tga[/COLOR]
}
}
The reflective car shader. Ubiquitous, and made much easier by the new system.
Code:
shader_[COLOR=green]body[/COLOR]
{
layer0
{
map=fresnel.tga
texgen_s=sphere_map
texgen_t=sphere_map
emission=1 1 1 1
mipmap=0
}
layer1
{
map=[COLOR=green]$trackenvmap[/COLOR]
texgen_s=reflection_map
texgen_t=reflection_map
texgen_r=reflection_map
blendfunc=filter
shininess=[COLOR=green]24[/COLOR]
specular=[COLOR=orange]0.75 0.75 0.75[/COLOR]
}
layer2
{
map=[COLOR=green]body.tga[/COLOR]
blendfunc=one src_alpha
mipmap=0
}
}
Code:
shader_[COLOR=green]body[/COLOR]
{
layer0
{
map=[COLOR=green]body.tga[/COLOR]
mipmap=0
shininess=[COLOR=green]24[/COLOR]
specular=[COLOR=orange]0.75 0.75 0.75[/COLOR]
emission= [COLOR=red].07 .07 .07[/COLOR]
}
layer1
{
map=[COLOR=green]$trackenvmap[/COLOR]
texgen_s=reflection_map
texgen_t=reflection_map
texgen_r=reflection_map
blendfunc=one_minus_dst_alpha one
}
}
Code:
shader_[COLOR=green]body[/COLOR]~vf_dyn_reflect
{
shininess=[COLOR=green]24[/COLOR]
specular=[COLOR=orange]0.75 0.75 0.75[/COLOR]
layer0
{
map=[COLOR=green]body.tga[/COLOR]
}
layer1
{
map=[COLOR=green]$trackenvmap[/COLOR]
}
}
The transparent glass shader. Tricky to get right, because you have to correctly mix layers together and render them in the right order.
Code:
shader_[COLOR=green]glass[/COLOR]
{
layer0
{
map=glass.tga
depthwrite=0
shininess=128
blendfunc=src_color one_minus_src_alpha
mipmap=0
}
layer1
{
map=[color=green]$trackenvmap
depthwrite=0
texgen_s=reflection_map
texgen_t=reflection_map
texgen_r=reflection_map
blendfunc=src_alpha one_minus_src_color
}
layer2
{
map=[COLOR=green]glass.tga[/COLOR]
shininess=[COLOR=green]40[/COLOR]
specular=[COLOR=orange]1 1 1[/COLOR]
depthwrite=0
blendfunc=[COLOR=red]src_color one_minus_src_alpha [/COLOR]
mipmap=[COLOR=green]0[/COLOR]
}
}
Code:
shader_[COLOR=green]glass[/COLOR]~vf_dyn_reflect_window
{
sort_offset=1
reflect=1.0
shininess=[COLOR=green]40[/COLOR]
specular=[COLOR=orange]1 1 1[/COLOR]
layer0
{
map=[COLOR=green]glass.tga[/COLOR]
blendfunc=[COLOR=blue]blend[/COLOR]
}
layer1
{
map=[COLOR=green]$trackenvmap[/COLOR]
}
[COLOR=blue]fresnel
{
bias=0.04
scale=0.96
power=4.0
}[/COLOR]
For the fresnel section, Cosmo° recommended
Code:
bias=0.04
scale=1.0
power=2.0
1.3.3 Pre-tweaked Shaders
The previously materials cover the majority of what you're going to need, if you just want to transfer old settings over. If the car doesn't come with shaders, you're unsatisfied with how they look, or you're just confused by the settings, there is an alternative. You can choose to use shaders already tweaked to look good. Here are some of those.
Code:
vf_dyn_gloss_paint
{
vertex_shader
{
file=dyn_standard_reflect_v.cg
}
fragment_shader
{
file=dyn_standard_reflect_f.cg
}
fresnel
{
bias=0.05
scale=0.95
power=3.0
}
reflect=1.0
specular=0.1 0.1 0.1
ambient=1 1 1
diffuse=1 1 1
shininess=16
}
Code:
shader_[COLOR=green]material[/COLOR]~vf_dyn_gloss_paint
{
compression=0
layer0
{
map=[COLOR=green]texture.tga[/COLOR]
}
layer1
{
map=$trackenvmap
}
}
2. Car Specific Files
2.1 views.ini
Unlikely to be a problem.
2.2 torque.crv
Unlikely to be a problem.
2.3 car.ini
Usually a problem.
See Cosmo°'s post for now.
3. Track Specific Files
3.1 spline.ini
Unlikely to be a problem.
3.2 track.ini
Will need minor updates.
3.3 ai/
Unlikely to be a problem.
3.4 tod/
Entirely new.
3.5 geometry.ini, movables001.ini
Will need minor updates.
3.6 special.ini
Always a problem.
4. QLOG.txt Errors
Likely to be arranged in alphabetical order, or by subject. The final step before sharing your work.
Will continue to add info, sleeping and such for now. Looking for suggestions on organization, formatting, etc. early on so I don't have to change much. Thanks!