racer home

Shadows - adding shadows to your track

 

Home Make it look better with realtime shadows being applied to the cars.


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

INTRODUCTION

Racer v0.5.2 beta 6.1 introduced some stencil shadow volume support. Stencil shadows can provide excellent shadows, which affect the cars & track.

An example of stencil shadows and how accurately they can shadow objects.

 

PROS

CONS

HOW TO TURN SHADOWS ON

In gfx.ini you can set your preferences on how to use shadows.

TrackEd can display shadow volumes in action; press F9 repeatedly to go through a few modes, showing the shadow model extrusions, the polygons rendered transparently and the actual stencil shadowing itself.

HOW TO ADD SHADOWING TO A TRACK

The track's geometry.ini file contains information on which models it should render. Normal, visible objects are stored in the objects { } tree, but shadow models are loaded separately using a shadows { } tree in a similar fashion. These objects (although 3D models) are not rendered as visible objects, but are used to generate shadow volumes (at track load time). This shadow volume is an extrusion of the shadow model, according to the light position(s); for now this is just the sun. An example shadow model is added like this:

shadows
{
  big_building_shadow
  {
    ; Model filename
    file=shadow_big_pitbuilding.dof
    ; Extrusion distance in meters; make this enough to cover any surrounding
    ; objects, but try to keep it within limits for performance reasons
    ; (smaller shadow volume polygons)
    extrude=30.0
  }
}

SHADOW MODEL PROPERTIES

The shadow models must adhere to some rules.

COMMON PROBLEMS

Symptom: Only occuring when the camera is not inside a shadow (resulting in Z-pass stencil shadowing). The bottom shadow is ok, but an 'echo' of the building persists in mid-air.
Cause: This is probably due to the extrusion distance not being enough.
Solution: Increase the extrusion distance (for example shadows.pitbuilding.extrude=40) until the problem disappears from all (!) angles. Use F9 in TrackEd to show the extrusion, and fly around it.

   

 


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

(last updated November 13, 2012 )