Sun light source

Moderator: GZDoom Developers

User avatar
Nash
 
 
Posts: 17429
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Sun light source

Post 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.
Last edited by Nash on Thu Jul 27, 2017 5:10 am, edited 1 time in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49053
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Sun light source

Post 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.
Gez
 
 
Posts: 17831
Joined: Fri Jul 06, 2007 3:22 pm

Re: Sun light source

Post 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 [wiki]fake contrast[/wiki]?
User avatar
Nash
 
 
Posts: 17429
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Sun light source

Post by Nash »

I imagine that would look funny though... lighting something equally from both opposing sides looks weird:

Image
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49053
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Sun light source

Post 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.
Gez
 
 
Posts: 17831
Joined: Fri Jul 06, 2007 3:22 pm

Re: Sun light source

Post 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.
User avatar
Nash
 
 
Posts: 17429
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Sun light source

Post 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!
User avatar
Chris
Posts: 2940
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Sun light source

Post 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.
User avatar
Nash
 
 
Posts: 17429
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Sun light source

Post 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?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49053
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Sun light source

Post 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.
dpJudas
 
 
Posts: 3036
Joined: Sat May 28, 2016 1:01 pm

Re: Sun light source

Post 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.
Gez
 
 
Posts: 17831
Joined: Fri Jul 06, 2007 3:22 pm

Re: Sun light source

Post by Gez »

dpJudas wrote:The front side's intensity needs to compliment the back
"Nice butts!"

Complement: complete
Compliment: flatter


:P
dpJudas
 
 
Posts: 3036
Joined: Sat May 28, 2016 1:01 pm

Re: Sun light source

Post by dpJudas »

From a light perspective it is all the same. :D
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Sun light source

Post by Major Cooke »

Engrish these days...
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

Re: Sun light source

Post by Edward-san »

How would you deal with portals?
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”