Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
It is currently Thu Sep 09, 2010 9:25 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Moving Shadows
PostPosted: Thu Feb 09, 2006 7:17 am 
Offline
picked up 200 ammo

Joined: Fri Nov 05, 2004 5:59 am
Posts: 200
I've only recently begun to build levels in the editor, but one thing that is driving me nuts is shadows not moving with flickering lights.

For example. I have a torch and bracket on a wall. I am using a flickering light. The shadow from the bracket is cast down the wall and onto the floor, however...the shadow doesn't move with the light. It's stationary, while the light shimmers all over the wall in a crazy dance. Perhaps I just don't understand how D3 lighting works...but I would assume that the shadows would move with a jiggling light.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 7:45 am 
Offline
Addict.
User avatar

Joined: Sat Aug 28, 2004 11:39 pm
Posts: 2240
are you using a flickering shader on the light


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 7:55 am 
Offline
a gun & a nice word
User avatar

Joined: Sat Jan 11, 2003 9:30 pm
Posts: 8550
Location: Orlando, FL
All lights in the game, make use of a falloff image and a center point.

When you apply a light shader, it makes dynamic changes to the falloff image but does not alter the center point of the light.

The problem being that shadows are cast from the center point, not the brightest point in the falloff image.

So, even though the light appears to be jittering around, it's center point is stationary. The result is stationary shadows.

_________________
Image Staff
Learn something today? Why not write an article about it on modwiki.net?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 8:20 am 
Offline
picked up 200 ammo

Joined: Fri Nov 05, 2004 5:59 am
Posts: 200
rich_is_bored wrote:
All lights in the game, make use of a falloff image and a center point.

When you apply a light shader, it makes dynamic changes to the falloff image but does not alter the center point of the light.

The problem being that shadows are cast from the center point, not the brightest point in the falloff image.

So, even though the light appears to be jittering around, it's center point is stationary. The result is stationary shadows.


So, no easy way around that huh?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 8:46 am 
Offline
Addict.
User avatar

Joined: Sat Aug 28, 2004 11:39 pm
Posts: 2240
if you could show us what your trying to do that would help


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 11:11 am 
Offline
did just hit his 750th monster
User avatar

Joined: Mon Mar 01, 2004 9:22 pm
Posts: 890
Lights can certainly move. Look into whether you can script the light position or center jittering about the original position.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 11:28 am 
Offline
fired 300 rounds
User avatar

Joined: Tue May 24, 2005 8:41 pm
Posts: 343
I asked about this in a previous thread and a suggested script was provided, but I can't find the thread any more. I think the script was a mover that moved the light to a random position within a certain volume.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 3:09 pm 
Offline
Very Senior Forum Poster
User avatar

Joined: Sun May 29, 2005 10:02 pm
Posts: 6006
Location: Here, not there.
a script could be used for this but the shadows always moving would eat up some CPU power.. more then static shadows.

something along these lines would work...

Code:
void flicker_light(entity light_orig, float max_variance)
{
   vector old_orig = light_orig.getWorldOrigin();      //ORIGIONAL start pos of light
   vector new_orig;               //where the light will move to
   vector temp_orig = old_orig;            //tempory old origin
   light_orig.time(.3);

   while (1)
    {
      float x = sys.random(max_varaince);
      float y = sys.random(max_varaince);
      float y = sys.random(max_varaince);
      new_orig_x = x + light_orig_x;
      new_orig_y = y + light_orig_y;
      new_orig_z = z + light_orig_z;
      light_orig.moveToPos(new_orig);
      temp_orig = new_orig;
    }
}


this should work. you might need to put a move in the same space & bind the light to a mover.

anyway, you enter in the name of the light entity & the max distance in the flicker. It stores the origin of the light & bases the movement on this origin.

Give it a try. :)

_________________
Fuzzy Logic Inc
PAINTBALL DOOM 3!!!!
Check out my Q2 server! q2server.fuzzylogicinc.com :D
Doom 3, Paintball! d3server.fuzzylogicinc.com


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 3:48 pm 
Offline
Quad Damage!
User avatar

Joined: Tue Jun 22, 2004 6:57 pm
Posts: 4779
Location: Green Bay, WI
if i remember correctly, trying to move the light's origin via a script does not work right.

when the engine compiles the map, it will look at all of the stationary lights and geometry and then calculate the static shadow volumes once. since the lights and geometry do not move, the shadows do not need to be calculated in real-time.

i think the only way to prevent this is to use a func_mover. this way the engines knows the light might move in the game and will not pre-calculate any static shadows.

_________________
Don't take the swine flu shot!


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 4:17 pm 
Offline
picked up 200 ammo

Joined: Fri Nov 05, 2004 5:59 am
Posts: 200
Our Dark Mod coding guys are on it. They're going to create a new light entity through the SDK, specifically for this.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 4:27 pm 
Offline
Very Senior Forum Poster
User avatar

Joined: Sun May 29, 2005 10:02 pm
Posts: 6006
Location: Here, not there.
yuppers.. you're right pb. I made a function that will "flicker" for ya. But for a mod horizon's method owuld be best so you would save on entities in the map.

anyway, here ya go:

Code:
//////////////////////////////////////////////////////////
//                     //
//         Mover Flicker         //
//                     //
//////////////////////////////////////////////////////////
/* This makes a mover flicker.*/

void flicker_light(entity mover, float max_variance, float travel_time)
{
   vector old_orig = mover.getWorldOrigin();      //ORIGIONAL start pos of mover
   sys.println(old_orig);
   vector new_orig;               //where the mover will move to
   vector temp_orig = old_orig;            //tempory old origin
   float x;
   float y;
   float z;
   mover.time(travel_time);

   while (1)
    {
      x = sys.random(max_variance);
      y = sys.random(max_variance);
      y = sys.random(max_variance);
      new_orig_x = x + old_orig_x;
      new_orig_y = y + old_orig_y;
      new_orig_z = z + old_orig_z;
      mover.moveToPos(new_orig);
      temp_orig = new_orig;
      sys.waitFor(mover);
    }
}


entity mover = the mover you want to flicker (bind it to a light, ragdoll... spaztic ragdolls! :) )
float max_variance = the farthest travel distance from the origionan mover origin (will never go farther)
float travel time = how long it takes to move from one point to another... IE flicker speed.

run it from a script like this:
Code:
   flicker_light($func_mover_1, 80, .06);


horizon.... this was a great idea. I would of never thought of this. Hopefully your code guys will have a faster way but this works good on a per-map basis. Plus I have a new function for my util script (find in my sig!). :)

_________________
Fuzzy Logic Inc
PAINTBALL DOOM 3!!!!
Check out my Q2 server! q2server.fuzzylogicinc.com :D
Doom 3, Paintball! d3server.fuzzylogicinc.com


Top
 Profile E-mail  
 
 Post subject: func_shake
PostPosted: Thu Feb 09, 2006 4:52 pm 
Offline
Captured the Flag

Joined: Mon Feb 21, 2005 6:07 pm
Posts: 1976
Location: usa/kansas
func_shake should do the trick alone but mixed with a few other elements should give nice variety but as far as shifting origins I have been able to use target_setkeyval to dot this in game. so maybe using a couple of those like two or three cycling but your entity count might get a little steep this way

_________________
it was bad enough imps and maggots everywhere but when that Hellknight copped a feel that was to much now I really was in hell
quote from rich is bored
""I can prove to anyone here that ghosts aren't real. You just have to let me kill you first.""


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 5:14 pm 
Offline
picked up 200 ammo

Joined: Fri Nov 05, 2004 5:59 am
Posts: 200
The Happy Friar wrote:
yuppers.. you're right pb. I made a function that will "flicker" for ya. But for a mod horizon's method owuld be best so you would save on entities in the map.

anyway, here ya go:

Code:
//////////////////////////////////////////////////////////
//                     //
//         Mover Flicker         //
//                     //
//////////////////////////////////////////////////////////
/* This makes a mover flicker.*/

void flicker_light(entity mover, float max_variance, float travel_time)
{
   vector old_orig = mover.getWorldOrigin();      //ORIGIONAL start pos of mover
   sys.println(old_orig);
   vector new_orig;               //where the mover will move to
   vector temp_orig = old_orig;            //tempory old origin
   float x;
   float y;
   float z;
   mover.time(travel_time);

   while (1)
    {
      x = sys.random(max_variance);
      y = sys.random(max_variance);
      y = sys.random(max_variance);
      new_orig_x = x + old_orig_x;
      new_orig_y = y + old_orig_y;
      new_orig_z = z + old_orig_z;
      mover.moveToPos(new_orig);
      temp_orig = new_orig;
      sys.waitFor(mover);
    }
}


entity mover = the mover you want to flicker (bind it to a light, ragdoll... spaztic ragdolls! :) )
float max_variance = the farthest travel distance from the origionan mover origin (will never go farther)
float travel time = how long it takes to move from one point to another... IE flicker speed.

run it from a script like this:
Code:
   flicker_light($func_mover_1, 80, .06);


horizon.... this was a great idea. I would of never thought of this. Hopefully your code guys will have a faster way but this works good on a per-map basis. Plus I have a new function for my util script (find in my sig!). :)


Hey there! :) Thanks for helping out. This was driving me crazy since all the torches in Thief 3 have a really nice dancing flame effect on shadows. Once our coders put this together, I'm sure we won't mind sharing it with the community.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 5:16 pm 
Offline
Very Senior Forum Poster
User avatar

Joined: Sun May 29, 2005 10:02 pm
Posts: 6006
Location: Here, not there.
yeah, func_shaking would work too. forgot about that. Only though of func_bobbing (which is only 1 axis).

it appears though that func_shaking only ROTATES the mover, not actuatly move it. This might/might not be good in some instances.

_________________
Fuzzy Logic Inc
PAINTBALL DOOM 3!!!!
Check out my Q2 server! q2server.fuzzylogicinc.com :D
Doom 3, Paintball! d3server.fuzzylogicinc.com


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 5:45 pm 
Offline
a gun & a nice word
User avatar

Joined: Sat Jan 11, 2003 9:30 pm
Posts: 8550
Location: Orlando, FL
It should be possible to assign a scriptobject to a light via a new entity declaration.

This way, you have a script jittering the light around but you don't have to call the function manually via a level script. Instead, the light will call it when it initializes.

_________________
Image Staff
Learn something today? Why not write an article about it on modwiki.net?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 6:28 pm 
Offline
Very Senior Forum Poster
User avatar

Joined: Sun May 29, 2005 10:02 pm
Posts: 6006
Location: Here, not there.
that's a great idea too. could have a special "light_flicker" entity. how would that work though because you also need a mover? unless.... you modify the script so that it gets the origin of the light, spawns a mover at the same origin, binds the light to the over & then runs the script. :D

i just don't know how script objects work with entities. :(

_________________
Fuzzy Logic Inc
PAINTBALL DOOM 3!!!!
Check out my Q2 server! q2server.fuzzylogicinc.com :D
Doom 3, Paintball! d3server.fuzzylogicinc.com


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 6:34 pm 
Offline
a gun & a nice word
User avatar

Joined: Sat Jan 11, 2003 9:30 pm
Posts: 8550
Location: Orlando, FL
It wouldn't require any other entities. The light would move itself around.

Think of it like giving a custom light entity AI only in this case, it's not "intellegent" at all. :)

_________________
Image Staff
Learn something today? Why not write an article about it on modwiki.net?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 8:12 pm 
Offline
picked up 200 ammo

Joined: Fri Nov 05, 2004 5:59 am
Posts: 200
rich_is_bored wrote:
It wouldn't require any other entities. The light would move itself around.

Think of it like giving a custom light entity AI only in this case, it's not "intellegent" at all. :)


I'll let you all know when we have something. :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 8:34 pm 
Offline
is really just an 855
User avatar

Joined: Fri Sep 24, 2004 10:36 pm
Posts: 1346
Location: California
I've been trying to think of a similar way to do this with torch fires after examining a small candle flame (in real life) with the lights off. I would see the shadows bobbing around, but the actual light remained constant (except when it occasionally dimmed around its edges when the flame got smaller).
I was thinking of a way to include a light source in a custom flame FX in the Quake 4 FX Editor that has some bobbing and moving properties. I figured it would be easier if I could get FXs to have this stuff built into them, but it seems someone already found another solution. I'm so slow. :lol:

EDIT: To clarify a little better, I'm trying to find ways to build in a shaking light into an FX so it could save the trouble of manually inserting a light, mover, shaker, and/or scripting into the map editor.


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 10:03 pm 
Offline
picked up 200 ammo

Joined: Fri Nov 05, 2004 5:59 am
Posts: 200
evilartist wrote:
EDIT: To clarify a little better, I'm trying to find ways to build in a shaking light into an FX so it could save the trouble of manually inserting a light, mover, shaker, and/or scripting into the map editor.


That's what our Dark Mod coders are going to add by using the D3 SDK. :) They'll just create a torchlight entity that jumps around like a real flame. Should look very nice ingame.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group