Sun light source

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

Sun light source

Postby Nash » Thu Jul 27, 2017 4:29 am

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 6:10 am, edited 1 time in total.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Sun light source

Postby Graf Zahl » Thu Jul 27, 2017 4:48 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Sun light source

Postby Gez » Thu Jul 27, 2017 5:10 am

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?
Gez
 
 
 
Joined: 06 Jul 2007

Re: Sun light source

Postby Nash » Thu Jul 27, 2017 5:20 am

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

Image
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Sun light source

Postby Graf Zahl » Thu Jul 27, 2017 5:39 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Sun light source

Postby Gez » Thu Jul 27, 2017 5:42 am

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.
Gez
 
 
 
Joined: 06 Jul 2007

Re: Sun light source

Postby Nash » Thu Jul 27, 2017 5:52 am

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
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Sun light source

Postby Chris » Thu Jul 27, 2017 6:01 am

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
Chris
 
Joined: 17 Jul 2003

Re: Sun light source

Postby Nash » Thu Jul 27, 2017 6:08 am

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
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Sun light source

Postby Graf Zahl » Thu Jul 27, 2017 6:13 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Sun light source

Postby dpJudas » Thu Jul 27, 2017 6:17 am

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.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Sun light source

Postby Gez » Thu Jul 27, 2017 6:51 am

dpJudas wrote:The front side's intensity needs to compliment the back

"Nice butts!"

Complement: complete
Compliment: flatter


:P
Gez
 
 
 
Joined: 06 Jul 2007

Re: Sun light source

Postby dpJudas » Thu Jul 27, 2017 7:11 am

From a light perspective it is all the same. :D
dpJudas
 
 
 
Joined: 28 May 2016

Re: Sun light source

Postby Major Cooke » Thu Jul 27, 2017 7:58 am

Engrish these days...
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Sun light source

Postby Edward-san » Thu Jul 27, 2017 2:40 pm

How would you deal with portals?
Edward-san
Mathematics is the language with which God has written the universe. (Galilei)
 
Joined: 17 Oct 2009

Next

Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 2 guests