Game Development Community

Looking up lighting info at arbitrary terrain point

by Andy Schatz · in Torque Game Engine · 08/16/2005 (4:20 pm) · 1 replies

How might I look up the non-dynamic lighting info at a particular point on the terrain? I'd like to base the lighting for individual foliage items on the lightmap information (at the initial ray-cast during foliage replication) so that my foliage items don't appear to glow during night or when they are in shadows.

#1
08/16/2005 (4:35 pm)
From sim/sceneObject.h:

/// Gets the color of the ambient light in the area of the object and
   /// stores it in the provided ColorF.
   ///
   /// @param   col   Ambient color (out)
   virtual bool getLightingAmbientColor(ColorF * col);

If you take a look at the implementation in sim/sceneObject.cc you'll see that it casts a ray straight down and then samples the lightmap information from the terrain object's lightmap or the interior's lightmap depending on what it hit.