TSE Lighting System Q&A
by John Kabus (BobTheCBuilder) · in Torque Game Engine Advanced · 09/07/2006 (4:53 am) · 49 replies
*Update*: The Torque Lighting System TDN section is nearly complete and now covers Torque Advanced (TSE), TGE 1.5, and TLK. The Torque Advanced (TSE) section was updated to include info on Lighting and Shadows, Performance Considerations, and updates and additions to the original articles. All articles were updated to include information on TGE 1.5 and note any differences between Torque Advanced, TGE 1.5, and TLK.
-John Kabus (9/30/2006)
//---------------------------------------------
TSE Lighting System Q&A
This is the official Lighting System Q&A thread. I'd like to try and keep the questions here so they are easier to answer and easier to find.
I'm happy to answer any Lighting System questions, but please read the
TSE Lighting System Documentation
First to see if your questions have already been answered.
Lighting
Static and dynamic lighting is setup for the legacy terrain (unless you're using custom shaders, but creating a custom lighting shader is a snap - I need to create a TDN article around that process), Atlas changed recently to add the new clip mapping, we're working on adding the static and dynamic lighting back in for 1.0.
So static and dynamic lighting works on all objects except Atlas (however dynamic DTS shadows do cast onto Atlas). Because the static lighting is not yet implemented Atlas uses the baked in light map provided when importing, so the lighting direction may look off, because Atlas is not yet using TSE lighting.
Dynamic Shadows
Regarding dynamic shadows; the shadows clip against interiors, terrain and Atlas similar to TGE dynamic shadows. This prevents the shadows from casting through walls. If you notice gaps it's due to the clipping - lowering the projection distance limits the likelihood of clipping.
Also you may notice that fluffy's shadow gets clipped near his head, this is because the bounding box doesn't completely enclose the mesh. You can account for this by using the object's datablock property shadowSphereAdjust. For more details check out the TDN article:
Dynamic Shadows.
HDR/DRL
I've also seen a few questions regarding the HDR system - it should be in and fully functional. HDR is controlled using the mission's sun object (the commented out prefs are from a prototype version that used prefs, I switched it to the sun, so HDR can be controlled per-mission) - make sure DRL is enabled too (HDR uses the underlying DRL system, but modifies it to use higher precision data), for details see the TDN article:
HDR and DRL
Also make sure Dynamic Range Lighting is enabled in the options dialog (or use the pref $pref::LightManager::sgUseDynamicRangeLighting).
-John Kabus (9/30/2006)
//---------------------------------------------
TSE Lighting System Q&A
This is the official Lighting System Q&A thread. I'd like to try and keep the questions here so they are easier to answer and easier to find.
I'm happy to answer any Lighting System questions, but please read the
TSE Lighting System Documentation
First to see if your questions have already been answered.
Lighting
Static and dynamic lighting is setup for the legacy terrain (unless you're using custom shaders, but creating a custom lighting shader is a snap - I need to create a TDN article around that process), Atlas changed recently to add the new clip mapping, we're working on adding the static and dynamic lighting back in for 1.0.
So static and dynamic lighting works on all objects except Atlas (however dynamic DTS shadows do cast onto Atlas). Because the static lighting is not yet implemented Atlas uses the baked in light map provided when importing, so the lighting direction may look off, because Atlas is not yet using TSE lighting.
Dynamic Shadows
Regarding dynamic shadows; the shadows clip against interiors, terrain and Atlas similar to TGE dynamic shadows. This prevents the shadows from casting through walls. If you notice gaps it's due to the clipping - lowering the projection distance limits the likelihood of clipping.
Also you may notice that fluffy's shadow gets clipped near his head, this is because the bounding box doesn't completely enclose the mesh. You can account for this by using the object's datablock property shadowSphereAdjust. For more details check out the TDN article:
Dynamic Shadows.
HDR/DRL
I've also seen a few questions regarding the HDR system - it should be in and fully functional. HDR is controlled using the mission's sun object (the commented out prefs are from a prototype version that used prefs, I switched it to the sun, so HDR can be controlled per-mission) - make sure DRL is enabled too (HDR uses the underlying DRL system, but modifies it to use higher precision data), for details see the TDN article:
HDR and DRL
Also make sure Dynamic Range Lighting is enabled in the options dialog (or use the pref $pref::LightManager::sgUseDynamicRangeLighting).
#42
John K.
10/01/2006 (1:02 am)
Is there any way to get a sgDecalProjector decal to project upon a DTS shape (either TSStatic or StaticShape)? Projecting upon an Interior shape and terrain works great. If there is to native support for this, are there any tips/pointers for engine implementation.John K.
#43
I think you'd be better off repurposing the shadows to project onto a DTS shape. e.g. A dummy object which isn't rendered other than for making a shadow.
@John Kabus,
EDIT: Figured it out.
10/09/2006 (7:32 pm)
@John Kanalakis,I think you'd be better off repurposing the shadows to project onto a DTS shape. e.g. A dummy object which isn't rendered other than for making a shadow.
@John Kabus,
EDIT: Figured it out.
#44
10/16/2006 (12:10 pm)
John, try using a spotlight and a light mask to project the texture onto all object types (use zone lighting to limit the lighting and avoid casting through interior walls into other zones).
#45
I'm trying to get the Relief map shader working that i found here: http://www.garagegames.com/mg/forums/result.thread.php?qt=52968, its all working fine but i can't workout how to get the shader to pickup the lighting system any help would be great, i'm trying to make models but the mormal maps are way to flat.
11/13/2006 (12:51 am)
Hi Guys, I'm trying to get the Relief map shader working that i found here: http://www.garagegames.com/mg/forums/result.thread.php?qt=52968, its all working fine but i can't workout how to get the shader to pickup the lighting system any help would be great, i'm trying to make models but the mormal maps are way to flat.
#46
11/15/2006 (1:39 am)
Removed - not an issue, was my problem with a missing datablock.
#47
i'm trying to workout how to inc the new lighting system in with a TSE custom shader but with no luck has anyone done this yet? or is there somewhere i can read up on it?? i'd love a reply to one thing i have asked.
Thanks.
11/26/2006 (5:29 pm)
@john or anyone that can help,i'm trying to workout how to inc the new lighting system in with a TSE custom shader but with no luck has anyone done this yet? or is there somewhere i can read up on it?? i'd love a reply to one thing i have asked.
Thanks.
#48
AFAIK, you need to set another customMaterial to be the dynamic light material. The geometry will be redrawn additively for each light with that material after the base customMaterial was drawn.
Example:
The shader for the dynamic light material will have a host of interesting info to work with, like the lighting model attenuation texture and the light information. You should take a look at the procedurally generated dynamic light shaders to see how they deal with the light information. You'll also need to assign some special texture names in order to access internally-generated textures, like lightmaps, attenuation textures and so on. You can see the avaliable tags in CustomMaterial::setStageData().
Example:
That way your shaders will recieve the light model attenuation texture in sampler S1.
11/28/2006 (5:30 am)
Quote:
I'm trying to workout how to inc the new lighting system in with a TSE custom shader but with no luck has anyone done this yet? or is there somewhere i can read up on it?? i'd love a reply to one thing i have asked.
AFAIK, you need to set another customMaterial to be the dynamic light material. The geometry will be redrawn additively for each light with that material after the base customMaterial was drawn.
Example:
new customMaterial(myLightMaterial)
{
...
}
new customMaterial(myBaseMaterial)
{
...
dynamicLightingMaterial = myLightMaterial;
...
}The shader for the dynamic light material will have a host of interesting info to work with, like the lighting model attenuation texture and the light information. You should take a look at the procedurally generated dynamic light shaders to see how they deal with the light information. You'll also need to assign some special texture names in order to access internally-generated textures, like lightmaps, attenuation textures and so on. You can see the avaliable tags in CustomMaterial::setStageData().
Example:
new customMaterial(myLightMaterial)
{
texture[0] = "./myTexture.png";
texture[1] = "$dynamiclight";
}That way your shaders will recieve the light model attenuation texture in sampler S1.
#49
thanks so much for giving me somewere to start i was lost big time.
11/28/2006 (11:40 pm)
Hi Manoel Neto,thanks so much for giving me somewere to start i was lost big time.
Torque Owner John Kabus (BobTheCBuilder)
Ishbuu, Brian does the code drops, so I can't give a solid date, but there are a few bugs I'm working out for the official MS4 release (the first announcement was only on the GG site) and those need to be posted to cvs before then.