|
2 registered members (TipmyPip, izorro),
556
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: cycles
[Re: AlbertoT]
#122522
04/10/07 15:39
04/10/07 15:39
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
Well, it depends. I'm not sure on the depth of your question.
It seems as if you just want a day/night cycle during your game. This is as simple a cycling a variable between 0-x(2400), usiing a small calculated number...
var cTime; var uTime = 0.01157; var fTime = 60; ... cTime = cycle(cTime + (uTime * fTime * time_step), 0, 24000); ... Hour = int(cTime / 1000); Minute = int(cTime / 24000); Second = int(cTime / 1440000);
cTime stores the current time; uTime Is the step to increase cTime by. fTime Is the time factor. At 1, it will go at regular time. at 60, a minute will pass every second.
This is untested though. So if it's wrong, then let me know and I'll set up a lil environment and test it.
xXxGuitar511 - Programmer
|
|
|
Re: cycles
[Re: xXxGuitar511]
#122523
04/10/07 17:32
04/10/07 17:32
|
Joined: Oct 2006
Posts: 1,245
AlbertoT
OP
Serious User
|
OP
Serious User
Joined: Oct 2006
Posts: 1,245
|
Quote:
It seems as if you just want a day/night cycle during your game.
Yes but I would like also to update shadows in real time
|
|
|
Re: cycles
[Re: AlbertoT]
#122524
04/10/07 18:23
04/10/07 18:23
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
You can not update static shadows (cast by blocks).
You can only change dynamic shadows cast by entities. For this you can either use stencil shadows, or you use a shader...
You could even do like GTA does, and not cast shadows. Don't use shadows, just use shading...
You could even use the camera.ambient variable to adjust the brightness of static shadows. I use this in my day/night cycle. Create your level as if it were night in WED. Place your lights and stuff where needed, but no sunlight. Then at runtime, when it's day, incease the camera.ambient variable to brighten those static shadows...
xXxGuitar511 - Programmer
|
|
|
Re: cycles
[Re: AlbertoT]
#122525
04/11/07 05:13
04/11/07 05:13
|
Joined: Sep 2002
Posts: 8,177 Netherlands
PHeMoX
Senior Expert
|
Senior Expert
Joined: Sep 2002
Posts: 8,177
Netherlands
|
Quote:
I found a Dynamic Shadows Demo on DX Studio Web site
" You can turn the world with the left/right cursor keys, or turn the light with Z/X. The real-time shadows will adapt to the light's position accordingly "
So it should be something relativly easy to implement
That demo uses regular stencil shadows, 3dgs has this too.
Cheers
|
|
|
|