How to relight just a very small portion of a scene?
by Stephen Zepp · in · 02/21/2005 (5:51 pm) · 2 replies
First, this may not be completely appropriate for this forum, but I wanted to check here first to see if there was an SLP way to handle it before seeing what could be done with stock TGE.
I've been trying to polish up my terrain deformation resource for community release, and one of the discovered issues is something I quite frankly didn't even think of: when the terrain is deformed, the baked in shadows no longer apply, and even more noticable is the fact that the craters themselves don't have shadows. This can be solved by opening up the world editor and relighting the mission, but obviously that isn't a good solution for released games.
My question is this: Is there a way to do dynamic re-lighting of at least a small portion of a scene to recalculate shadows on terrain? Ideally, we would do a very short pass on a very small region of terrain, so that the player doesn't have a noticable delay.
Alternatively, is there a mechanism within SLP that can allow for dynamic shadows on terrain from the terrain itself? .dif shadows would be a bonus of course, but not completely critical.
Thanks in advance!
P.S.: For a visual reference, please see Joshua Dallman's most recent .plan. The first screenshot shows a field of small craters post re-light. Pre re-light, the craters are almost not noticeable--the shadows show the depth of the crater to very great effect, but on the sand colored terrain texture, they are just about invisible until relit.
I've been trying to polish up my terrain deformation resource for community release, and one of the discovered issues is something I quite frankly didn't even think of: when the terrain is deformed, the baked in shadows no longer apply, and even more noticable is the fact that the craters themselves don't have shadows. This can be solved by opening up the world editor and relighting the mission, but obviously that isn't a good solution for released games.
My question is this: Is there a way to do dynamic re-lighting of at least a small portion of a scene to recalculate shadows on terrain? Ideally, we would do a very short pass on a very small region of terrain, so that the player doesn't have a noticable delay.
Alternatively, is there a mechanism within SLP that can allow for dynamic shadows on terrain from the terrain itself? .dif shadows would be a bonus of course, but not completely critical.
Thanks in advance!
P.S.: For a visual reference, please see Joshua Dallman's most recent .plan. The first screenshot shows a field of small craters post re-light. Pre re-light, the craters are almost not noticeable--the shadows show the depth of the crater to very great effect, but on the sand colored terrain texture, they are just about invisible until relit.
Torque Owner John Kabus (BobTheCBuilder)
I've devised several ways to recalculate terrain and interior lighting, but only for Lighting Pack lights (non-directional). The stock code for direction lighting in Torque can be broken up into smaller relight pieces, but ultimately the relight will still be very noticeable during a game.
For what Joshua is trying do (creating holes), I would skip the relight and use a custom 'lighting' method. As an example I would try the following logic:
This will darken parts of the terrain that are now facing more away from the sun than before, and will prevent surfaces that were already facing away from the sun or shadowed from becoming bright, giving a shadowed effect.
As an additional fudge factor I would try purposely darkening the deformed terrain or applying a detail texture for a scorched effect.
Let me know if this helps!
Btw: Joshua's work is awesome! :)
-John