Page 1 of 4

Sun light source

PostPosted: Thu Jul 27, 2017 4:29 am
by Nash
I was telling dpJudas on Discord yesterday about how I ran into this problem. I figured it would be better to make an open suggestion thread because it involves more than the model and lighting code.

What I proposed on Discord was the ability for modders to specify a single, infinitely-distanced "sun" light source that would light everything sector-wide. This would be a UDMF control (so ZZYZX can add UI to control it in GZDB-BF), to allow mappers to control the light design.

Alternatively, Chris suggested making the sun map-wide instead of per-sector. My motivation of making it per sector is, you may want to have an indoor area beside an outdoor area (think of Strife's town map)... they all shouldn't have the same lighting direction.

The problem with Doom lighting is there are no light sources, so everything is lit uniformly. See this example image:

Image

The only way to light those trees in this scene is to continuously place dynamic lights close to each other, just to provide something for the lighting shader to draw with. This isn't practical, and not to mention spamming dynamic lights all across that map is expensive.

Please note that I know the scene I made is excessive in terms of visible thing count, but this is just an exaggerated example. In a real mapping situation, of course I won't spam things in view with no blocking lines, but that's beside the point of this suggestion.

(By the way, even for a smaller scene, placing dynamic lights continuously isn't practical... the lighting would look wrong because it's coming from so many directions. It doesn't look good; I've already tried doing it)

The point is that, I'm suggesting a single light source that would globally light things in a sector, with infinite distance.

Parameters:
Light colours R, G B
Angle
Pitch

This would be a mapping feature. Existing Doom maps and mods won't be affected, and will continue to use uniform lighting for models.

Link to test file will be provided in the dev thread.

Re: Sun light source

PostPosted: Thu Jul 27, 2017 4:48 am
by Graf Zahl
As long as you do not want to cast shadows from map geometry this is certainly doable. Obviously this should not replace the sector light level, but add to it. You'll always need some ambient light to avoid too hard shadows on the opposite side to the light.

Re: Sun light source

PostPosted: Thu Jul 27, 2017 5:10 am
by Gez
Nash wrote:This would be a mapping feature. Existing Doom maps and mods won't be affected, and will continue to use uniform lighting for models.


How about defaulting to using two "suns" on "sunless" maps (one straight to the east, the other opposite to the west) to be consistent with fake contrast?

Re: Sun light source

PostPosted: Thu Jul 27, 2017 5:20 am
by Nash
I imagine that would look funny though... lighting something equally from both opposing sides looks weird:

Image

Re: Sun light source

PostPosted: Thu Jul 27, 2017 5:39 am
by Graf Zahl
What should a 'sun' affect anyway? Only models would look strange, it would need to have an effect on map geometry as well. If the entire proposition amounts to "hack that makes model lighting look better", count me out.

Re: Sun light source

PostPosted: Thu Jul 27, 2017 5:42 am
by Gez
Nash wrote:I imagine that would look funny though... lighting something equally from both opposing sides looks weird:

Image


Perhaps, but it's how it works in Doom. And it's no worse than lighting equally from the entire infinity of sides.

Graf Zahl wrote:What should a 'sun' affect anyway? Only models would look strange, it would need to have an effect on map geometry as well. If the entire proposition amounts to "hack that makes model lighting look better", count me out.


Yeah, maps with a sun would need to also use it to override normal fake contrast with a single-directional smooth lightning.

Re: Sun light source

PostPosted: Thu Jul 27, 2017 5:52 am
by Nash
Gez wrote:Yeah, maps with a sun would need to also use it to override normal fake contrast with a single-directional smooth lightning.


Sounds good! And reading your suggestion again, it does make sense to unify the lighting across everything.

EDIT: coming to think of it again, maps affected by the sun's lighting would produce 10000000x better lighting... to be blunt, I'm not much of a fan of the fake contrast for modern mapping. I know I can turn off fake contrast but then I'd have to go over every single linedef to light them manually via UDMF. Too much effort. Having 1 sun do all the lighting makes work much easier!

Re: Sun light source

PostPosted: Thu Jul 27, 2017 6:01 am
by Chris
Nash wrote:What I proposed on Discord was the ability for modders to specify a single, infinitely-distanced "sun" light source that would light everything sector-wide.

Wouldn't it be more practical to have it map-wide? I could see color being useful as a a per-sector property (or maybe bounded zones, ala reverb), but an infinite-distance light source only makes sense to have a single global direction. This would allow it to affect map geometry, given the angle of walls, floors, and ceilings in relation to it (and maybe in the future, normal maps). The tricky thing will be what to do about sprites.

Re: Sun light source

PostPosted: Thu Jul 27, 2017 6:08 am
by Nash
I agree about making it map-wide, but my motivation was that, imagine Strife's town map. You wouldn't want every sector to have the same sun direction. The outdoor areas could have a sun placed in the sky at a 45 degree angle, maybe you want the shops to have a "sun" originating 90 degrees from the ceiling.

I'll edit my first post, regardless.

About sprites... what's the issue? Are you saying they will look bad if they simply take the sun's colour and lighting?

Re: Sun light source

PostPosted: Thu Jul 27, 2017 6:13 am
by Graf Zahl
Chris wrote:The tricky thing will be what to do about sprites.


Nothing really. There's no good way to handle them aside from using the sun as an additional light source.

The far bigger issue is, what parts of the map to light by the sun. Do it only in sky sectors it may look odd, same if you do it everywhere. Maybe dpJudas has some ideas but I don't think it can be made to work without some issues owed by Doom's map format.

Re: Sun light source

PostPosted: Thu Jul 27, 2017 6:17 am
by dpJudas
I experimented with declaring a fake directional light map-wide back in the day. It looked great some places (mostly outside), but very bad other places. If the sector is very dark the directional light need to take that into account.

I think Graf is definitely onto something with the backside being the sector light. The front side's intensity needs to compliment the back, otherwise it will not look good.

Re: Sun light source

PostPosted: Thu Jul 27, 2017 6:51 am
by Gez
dpJudas wrote:The front side's intensity needs to compliment the back

"Nice butts!"

Complement: complete
Compliment: flatter


:P

Re: Sun light source

PostPosted: Thu Jul 27, 2017 7:11 am
by dpJudas
From a light perspective it is all the same. :D

Re: Sun light source

PostPosted: Thu Jul 27, 2017 7:58 am
by Major Cooke
Engrish these days...

Re: Sun light source

PostPosted: Thu Jul 27, 2017 2:40 pm
by Edward-san
How would you deal with portals?