Sun light source
Moderator: GZDoom Developers
Sun light source
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:
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.
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:
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.
Last edited by Nash on Thu Jul 27, 2017 5:10 am, edited 1 time in total.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Sun light source
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
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 [wiki]fake contrast[/wiki]?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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Sun light source
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
Perhaps, but it's how it works in Doom. And it's no worse than lighting equally from the entire infinity of sides.
Yeah, maps with a sun would need to also use it to override normal fake contrast with a single-directional smooth lightning.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.
Re: Sun light source
Sounds good! And reading your suggestion again, it does make sense to unify the lighting across everything.Gez wrote: Yeah, maps with a sun would need to also use it to override normal fake contrast with a single-directional smooth lightning.
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!
- Chris
- Posts: 2942
- Joined: Thu Jul 17, 2003 12:07 am
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Sun light source
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.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.
Re: Sun light source
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?
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?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Sun light source
Nothing really. There's no good way to handle them aside from using the sun as an additional light source.Chris wrote:The tricky thing will be what to do about sprites.
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
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.
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
"Nice butts!"dpJudas wrote:The front side's intensity needs to compliment the back
Complement: complete
Compliment: flatter
Re: Sun light source
From a light perspective it is all the same.
- Major Cooke
- Posts: 8176
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Sun light source
Engrish these days...
-
- Posts: 1774
- Joined: Sat Oct 17, 2009 9:40 am
Re: Sun light source
How would you deal with portals?