racer home

Creating custom reflection maps

 

Home Give it some wings.


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

Introduction

This article describes how to generate environment maps that can be used as alternative reflection maps. For cars, you often just want the $trackenvmap texture (see shaders) since that is updated with the car as the center.

However, for track objects, such as buildings with window panes, you will want to avoid the $trackenvmap since that often contains visuals close to the car. For example, the road, kerbs and such. You don't want these to reflect in track objects, but rather create your own.

Custom reflection maps require Racer v0.8.40+.

Steps to use a custom-generated track environment map

The nicest maps are generated in the actual track itself, not trying to create envmaps in an editor such as Photoshop. Here are the steps to grab an environment map from within Racer:

Initial assumptions

Render a reflection map

Using a reflection map in your shader definitions

The shader (in track.shd) can look as follows (the vf_reflect_window tree is just a template that is referenced by the actual shader, shader_glass):

vf_reflect_window
{
vertex_shader
{
file=dyn_standard_reflect_window_v.cg
}
fragment_shader
{
file=dyn_standard_reflect_window_f.cg
}
} ... shader_glass~vf_reflect_window
{
reflect=50.0
diffuse=1 1 1
ambient=0.8 0.8 0.8
specular=0.1 0.1 0.1
cull=none
layer0
{
map=glass.tga
}
layer1
{
map=glass*.tga
}
}

 

On 8 bits vs 16 bits

The nicest quality for an envmap would be 16-bits, giving a higher dynamic range. The pros for 8 bits are that it uses generic .tga files, so you can modify the TGA files after generating them. For example, you can use Photoshop to blur them a bit for softer reflections.


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

(last updated November 13, 2012 )