Page 1 of 1

Dynamic shadows to show time of day

Posted: Thu Dec 03, 2020 11:57 am
by ViciousVinnyD
So I noticed the game uses black silhouette sprites on the ground to emulate shadows cast by the sun. By scaling the sprite horizontally you could probably mimic the sun crossing the sky with little cost to the game.

Also since this game likes animated machines so much why not make the solar panels tilt left to right with the sun?

Re: Dynamic shadows to show time of day

Posted: Thu Dec 03, 2020 2:30 pm
by Klonan
ViciousVinnyD wrote: Thu Dec 03, 2020 11:57 amBy scaling the sprite horizontally you could probably mimic the sun crossing the sky with little cost to the game.
If only it were that simple :)

Re: Dynamic shadows to show time of day

Posted: Thu Dec 03, 2020 11:53 pm
by KeepResearchinSpoons
At best it would probably come to changing alpha chan of the shadow sprite depending of the surrounding light level; but meh is it too costly for each of the shadow to calc? Shortcut depending on the sun level for low cost logic? Meh it's waaai too SHADY stuff...

We still have that bright moon that shines over the nauvis since forever.
Especially true with cave scenarios like diggy where the time is actually locked to midnight :>

Re: Dynamic shadows to show time of day

Posted: Fri Dec 04, 2020 1:08 am
by kirazy
Imo, just having the shadows fade to almost invisible at night would be a marked improvement. But I think trying to simulate a proper day-night cycle with static sprites is asking a lot.

Re: Dynamic shadows to show time of day

Posted: Fri Dec 04, 2020 2:45 am
by adamwong246
I don't think it's possible to do this with sprites? Without some sort of 3d representation, how could you make a shadow of, say, a telephone pole? Every item in the game would need a whole new set of sprites and not just one. Maybe you could come up with some sort of compressed representation of a shadow for each item but that sounds like a ton of work too.

Re: Dynamic shadows to show time of day

Posted: Fri Dec 04, 2020 2:52 am
by kirazy
adamwong246 wrote: Fri Dec 04, 2020 2:45 am I don't think it's possible to do this with sprites? Without some sort of 3d representation, how could you make a shadow of, say, a telephone pole? Every item in the game would need a whole new set of sprites and not just one. Maybe you could come up with some sort of compressed representation of a shadow for each item but that sounds like a ton of work too.
Most structures already have their shadows as separate sprites that are drawn on a shadow layer, so adjusting the alpha probably (?) wouldn't be too much trouble. Shifting them throughout the day would probably look bad, as the shadows are cast from a light source to the west, so even if you project the shadow to the west as though the sun is rising, it would look wrong.

Re: Dynamic shadows to show time of day

Posted: Fri Dec 04, 2020 3:07 am
by adamwong246
Are you saying that objects in the game already have shadow layers? I don't think that's right but I really don't know. (I don't know that much about pixel art) If you had the art assets, yeah, it would be do-able. But to make those shadow layers would require a ton of art-work.

Here's an shim idea: Instead of a pixel perfect shadow for each item, just cast a gray oval with some alpha effects in the correct direction. Give each item a shadow-size between 0 for nothing, 1 for really skinny things like telephone polls and 10 for full size assembly machines and that determines the size of they grey oval. That _might_ look ok. It also might look like poop.

Re: Dynamic shadows to show time of day

Posted: Fri Dec 04, 2020 3:38 am
by kirazy
adamwong246 wrote: Fri Dec 04, 2020 3:07 am Are you saying that objects in the game already have shadow layers? I don't think that's right but I really don't know. (I don't know that much about pixel art) If you had the art assets, yeah, it would be do-able. But to make those shadow layers would require a ton of art-work.
Yes, that is what I am saying. Pipes and belts have their shadows baked in (and a few other entities that haven't received recent love and attention) but in general structures have separate shadow layers.

Re: Dynamic shadows to show time of day

Posted: Fri Dec 04, 2020 3:45 am
by adamwong246
Wow I had no idea. I'd want to take a closer look at these shadow layers first but yeah I guess it is possible.

Re: Dynamic shadows to show time of day

Posted: Fri Dec 04, 2020 5:15 am
by ssilk
This suggestion is very old.
viewtopic.php?f=6&t=64483 [0.16.51] more natural shadows

viewtopic.php?f=6&t=44149 Better environment

viewtopic.php?f=6&t=2287 3D rendering

viewtopic.php?f=6&t=1089 Some thoughts about light in general (2013!)

Also related:

viewtopic.php?f=5&t=43661 Unsolved mysteries

Re: Dynamic shadows to show time of day

Posted: Fri Dec 04, 2020 4:55 pm
by adamwong246
This is a nice visual flourish but if it incurred any amount of FPS/UPS degradation, I would ask for the option to disable shadows. I've already disabled animations all together to preserve RAM.

Re: Dynamic shadows to show time of day

Posted: Fri Dec 04, 2020 5:05 pm
by Deadlock989
KeepResearchinSpoons wrote: Thu Dec 03, 2020 11:53 pm We still have that bright moon that shines over the nauvis since forever.
Especially true with cave scenarios like diggy where the time is actually locked to midnight :>
Since 0.18 any scenario/mod can do a lot more than the default with day and night light intensity and colour. You can have pitch black darkness or a hot pink sunset if the mod/scenario sets those night light levels and brightness visual weights.
adamwong246 wrote: Fri Dec 04, 2020 3:07 am Here's an shim idea: Instead of a pixel perfect shadow for each item, just cast a gray oval with some alpha effects in the correct direction. Give each item a shadow-size between 0 for nothing, 1 for really skinny things like telephone polls and 10 for full size assembly machines and that determines the size of they grey oval. That _might_ look ok. It also might look like poop.
"Poop" would be a kindness.

Re: Dynamic shadows to show time of day

Posted: Fri Dec 04, 2020 6:10 pm
by posila
Graveyar Keeper does something like oval with very smooth fade out and it works pretty well for them, I think https://www.gamasutra.com/blogs/Svyatos ... e_made.php

Our art direction is to have sharp shadows, changing their "darkness" during day-night cycle would be possible too (but they are supposed to be visible during night, as they are the most important element of making entities look grounded)

Skewing them a little bit might work without noticable problems, but IMHO the effect would not be interesting enough to make it worth go through fixing all the issues where shadows are composed of different sprites with different offsets. Artist are more interested in having dynamic shadows moving light sources (player, trains, cars ... or even lamps) during night, rather then just for shadows casted from sun/moon. However, in the end, it was deemed that having completely static shadows is less distracting to players than some kind of approximation of dynamic shadows that would often fail to be convincing.