Torque/LightingSystem/Migrating From TLK

From TDN

Introduction

TLK's core lighting system (the Torque Lighting System) is now integrated into TGEA and TGE 1.5. The lighting system is nearly identical to TLK in features and tools, though some code changes were made.

This section discusses the changes that occurred between the TLK 1.4.x and TGEA / TGE 1.5 versions of the Torque Lighting System.

Contents


Overview

TLK was designed to extend Torque's existing lighting and rendering systems. TLK's classes add new methods and functionality to Torque's existing classes. In contrast the Torque Lighting System replaces the TGEA / TGE 1.5 lighting system, which provided the opportunity to re-implement several legacy portions of Torque, including the LightManager, SceneLighting, and Shadow classes.

Because of these changes, general cleanup, and updated features, there are code differences between the TLK and TGEA / TGE 1.5 versions of the Torque Lighting System, however the objects, features, and usage are almost identical - meaning a project can be directly ported from TLK to TGEA / TGE 1.5 with nearly all lighting system features intact (mission lights, filters, decal projectors, all related datalocks, ...).


TGEA related info:

The only features not available in TGEA are detail mapping (replaced with bump mapping) and illuminated particles (particles that receive lighting).

Where is the Lighting System Located?

Lighting system source files and project groups were moved from
engine/synapseGaming/contentPacks/lightingPack to engine/lightingSystem.

Where did sgUniversalStaticLight go?

The light object class was renamed sgLightObject (the datablock class was renamed sgLightObjectData). Descendant classes named sgUniversalStaticLight and sgUniversalStaticLightData were added, so missions ported from TLK will work without modification, and the Light Editor works with both datablock classes, however it's recommended to use sgLightObject when creating new content to avoid problems in the future.

Light Manager

The original Torque light manager was replaced with the Torque Lighting System's version, which is lighter weight, more streamlined, and provides better support for object-specific lighting (like linked lighting). The new light manager provides interfaces and functionality similar to the original.

The light manager is now the central location for all lighting system prefs. All original TLK prefs were removed and new prefs performing the same functions were added to the light manager.

Scene Lighting

Most of scene lighting was replaced to route all lighting through the Torque Lighting System light mapping and lighting model system - except for directional terrain lighting, which continues to use the original code (due to inaccurate normal information from the terrain block). The new scene lighting continues to use a lot of the original persistence code from Torque and the event model from TLK.

Dynamic DTS Shadows

In TGEA the dynamic DTS shadow class (Shadow) was replace with two classes; sgObjectShadows and sgShadowProjector.

The sgShadowProjector object provides a shadow buffer unique to the light/object combination, which handles all shadow casting related processing including self-shadowing.


In both TGEA and TGE 1.5 ShapeBase derived classes contain an sgObjectShadows object that manages all the shape's shadows (the sgShadowProjector class in TGEA, and Shadow class in TGE 1.5).