Jump to content
The Dark Mod Forums

Parallel lights usage


stgatilov

Recommended Posts

I think we should deprecate parallel lights.

The way they are implemented in Doom 3 only works intuitively if it is fully contained in a single visportal area, which is rarely the case.
Otherwise, there are huge issue with area-portal graph and shadows.

For something global like moonlight, the new parallelSky light should be used.
If it is contains the whole level in its light volume, then the behavior should be well-defined as long as portalsky material is used to seal levels from the sky (not caulk or something similar). The light is supposed to come through the portalsky surfaces into all areas in this case.

Are there any other usages of parallel lights?

  • Like 1
Link to comment
Share on other sites

  • nbohr1more featured and pinned this topic

I guess I am not entirely certain of the ramifications of this, I often use parallel lights but usually with both the spawnargs "parallel" and "parallelSky" set to "1" and always as a way to put a large directional light into a scene. I do use additional parallel lights without the parallelSky spawnarg for smaller fill and bounce lights. I don't know if basically turning that spawnarg on would even impact the appearance of the lights.

It doesn't sound like a big deal but I guess it would be nice to understand the impact more? 

  • Like 1

-=  IRIS  =-    ♦    = SLL =

Link to comment
Share on other sites

Personally have really no good opinion on this, mostly because I have almost no knowhow, on how TDM (or idtech 4 for that matter) low level render works. So I really don't know, if killing old parallel lights, would be good or not, but if you think they are more trouble than good... And how many daylight missions exist in TDM anyway? Honest question.

But, to those that perhaps want to do day light, would making sun light, still be mostly the same using the parallelSky?

One thing that IMO was cool about the parallel light, compared to other lights, is that it doesn't care where it is on the world, it only cares about its axis rotation, and it afaik was capable to "project" light from any direction, is that conserved with parallelSky? I'm asking because the sky part, in its name to me makes it sound, like it only can cast light in a semi-sphere, like a dome.

 

Edit: Reading this on TDM wiki explained a few more things, it seems I was wrong when I thought parallel lights didn't cared where they were on the world, it seems they do for portal flowing at lest.  

Edited by HMart
Link to comment
Share on other sites

2 hours ago, HMart said:

And how many daylight missions exist in TDM anyway? Honest question.

There's Reap as you Sow, which is mostly bright daylight.

  • Like 2

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

I've also been using parallel lights as a way of illuminating windows so they look closer to self-lit than you get just by putting a regular point or projected light nearby. I make them window-shaped and thin so that the only surface they touch is the windowpane. This is probably awful practice but so far it hasn't broken anything or tanked the framerate. If the new and improved parallelSky can do something similar I will swap them out but I would not want to have to go back to point or projected lights for this.pseudo_selflit.jpg.078bf193f7b95d774e3c5a56863f0707.jpg

 

Here's two windows lit by two lights with the same dimensions, colours, and relative positions. Specular is turned off. The left one is just a pointlight and the right one is a parallel light. I think it's clear which one looks more like there's a lit room behind it. The illusion's not perfect, but it's significantly better.

 

  • Like 1

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

50 minutes ago, thebigh said:

Here's two windows lit by two lights with the same dimensions, colours, and relative positions. Specular is turned off. The left one is just a pointlight and the right one is a parallel light. I think it's clear which one looks more like there's a lit room behind it. The illusion's not perfect, but it's significantly better.

Sorry for the off topic but nice out of the box thinking thebigh. :)  But IMO doing that light from behind effect, would be best done through the window material using a blend add stage.

Or I would use a cheap blend light instead of a real parallel light. (just put the global material keyword 'blendLight' in the light material and do a blend add) Blend lights don't support specular and normal mapping, but for such effect I don't think that matters anyway, but I could be wrong.

Plus you can project a texture with blend lights as well and so you could create a blend add (black&white) mask texture that would light the glass parts and not the wood parts of the window, where on real life, light wouldn't never show though. 

Edited by HMart
  • Like 1
Link to comment
Share on other sites

I think there is no problem with noshadows parallel lights: they are well-defined in the current engine.

It can be used as local light to brighten the window, as @HMart does.
I hope there is no reason to have shadows in this case?


The parallel and parallelSky are almost the same thing, except that parallelSky traces light beams from areas containing portalsky world surfaces, while parallel traces light beams from the area where light origin is located, which is never what you need for a global parallel light (like moonlight).

There are many missions where this issue is hacked around, and all of them result in issues like double lighting if door is open, or lack of lighting in some outdoors areas. And there is no way to fix the engine to make these missions work properly --- the maps themselves are wrong.

If you want to do a global parallel light, the parallelSky is surely what you want to have, and parallel is most likely not. But note that to make parallelSky work you also need to follow some rules.


The issue with local parallel light is that objects outside light volume can cast shadow over objects inside light volume.
This is pretty weird by itself: you move object closer to light volume, and at some point its shadow instantly turns on.

The engine determines whether object intersects light volume approximately (using bounding boxes and such stuff), so whether you get shadow from an object close to light volume or not is implementation-defined. Today you have no shadow and it looks nice, tomorrow culling is changed and the scene gets unexpected shadow.

 

So the bottom line is:

  • Global parallel lights should use parallelSky and follow some rules.
  • Local parallel lights should be noshadows.
  • All the rest is not well-defined: you'll avoid a lot of trouble by avoiding it altogether.
Link to comment
Share on other sites

Hmm...

I guess for the use case of parallel lights for windows, the best approach would be to move the light_center as far back as possible to approximate a parallel style shadow. AFAIK, it is permitted to have the light_center outside the light volume no? (thus having a similar design to the old parallel light with an "infinitely far light_center" ).

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

1 hour ago, stgatilov said:

I think there is no problem with noshadows parallel lights: they are well-defined in the current engine.

It can be used as local light to brighten the window, as @HMart does.

I don't deserve that credit, using parallel lights to light windows is user thebigh process. ;) 

Link to comment
Share on other sites

The nice thing about the parallel lights is that they're easy and quick to set up. For decorative windows that the player won't approach too closely, they look a lot better than point lights and are almost as fast to place, and the illusion doesn't have to be perfect. Mucking about with shader definitions is still a bit arcane for me.

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

On 6/23/2023 at 4:55 PM, stgatilov said:

So the bottom line is:

  • Global parallel lights should use parallelSky and follow some rules.
  • Local parallel lights should be noshadows.
  • All the rest is not well-defined: you'll avoid a lot of trouble by avoiding it altogether.

So what are we saying here?  We're not going to deprecate them, and we should still use them but follow the guidelines you set out?

Link to comment
Share on other sites

26 minutes ago, Frost_Salamander said:

So what are we saying here?  We're not going to deprecate them, and we should still use them but follow the guidelines you set out?

The idea is to deprecate Doom 3 style "parallel" light.
Use "parallelSky" light instead.

And if you want the light to have shadows, then:

  1. make it global, i.e. cover the whole world
  2. make sure portalsky material marks the sky instead of caulk or anything else
  3. hope that it works 😥
Link to comment
Share on other sites

18 minutes ago, stgatilov said:

The idea is to deprecate Doom 3 style "parallel" light.
Use "parallelSky" light instead.

And if you want the light to have shadows, then:

  1. make it global, i.e. cover the whole world
  2. make sure portalsky material marks the sky instead of caulk or anything else
  3. hope that it works 😥

OK, I guess I'm asking what spawnargs will be supported.  From reading the Wiki entry on them I don't really understand how they work (but that's OK, I'm just starting to play with them). So if I decide to use them I don't want to use some feature/spawnarg that will be deprecated.

The Wiki says:

Quote

In TDM 2.08, a new spawnarg parallelSky was added. If you add it to a parallel light and set value "1"...

Which implies both 'parallel' and 'parallelSky' spawnargs are needed to create a 'parallel sky' light.  Also, you suggest for 'local' parallel lights to use 'noshadows'.  Does 'local' mean  with 'parallel' and without 'parallelSky' spawnarg?. So I don't really understand what's actually being deprecated. Just the shadowcasting on local parallel lights? Sorry if I'm being dumb here.

I have no view on whether or not they should be deprecated since I've never used them, but reading this thread it sounds like they have their uses and I should look at them. 

  • Like 1
Link to comment
Share on other sites

15 minutes ago, Frost_Salamander said:

Which implies both 'parallel' and 'parallelSky' spawnargs are needed to create a 'parallel sky' light.

Actually, "parallelSky" spawnarg implies "parallel" in the engine.
You don't need to set both flags, just make sure to set "parallelSky".

Quote

Also, you suggest for 'local' parallel lights to use 'noshadows'.  Does 'local' mean  with 'parallel' and without 'parallelSky' spawnarg?.

For a noshadows light, they both behave exactly the same and have no issue.

Quote

So I don't really understand what's actually being deprecated. Just the shadowcasting on local parallel lights? Sorry if I'm being dumb here.

In terms of spawnargs, "parallel" spawnarg without "parallelSky" spawnarg should be deprecated.
I think this is what I can check in dmap and give a warning. Maybe I'll exclude noshadows "parallel" case because it is equivalent anyway.

In terms of functionality, there is nothing being deprecated: parallelSky serves as better replacement or is the same in every case.

Yes, local shadowing parallel lights never worked, still don't work, and I'm afraid will never work. If someone wants to use them, he can slap "parallelSky", but I'd seriously advice against the very idea.

 

  • Like 1
Link to comment
Share on other sites

  • 6 months later...

I replaced the moonlight setup in Collateral with a global parallelSky light. It seems to work as expected and is much easier to setup. Cool.

 

@stgatilov

The moon light entities had "nodiffuse" set to 1. I don't remember why. What effect does this have?

"nospecular" was also set. Does this have a noticeable performance impact?

Link to comment
Share on other sites

This is what I personally know about it:

No diffuse means "skip the diffuse path code for this light" essentially means don't add/mix this light color/texture color info unto the surface, only use it as a simple b&w light.

No specular is essentially the same but for specular textures, it skips the specular component/code/calculation and makes the light less heavy by removing the specular effect.

About performance impact, for today GPU's, I don't think is as important as it was in 2004, but still, I'm sure it does have a small impact on performance, for the better of course, specially if done for many lights, but will also make them way more unrealistic.

Btw lights with both no diffuse and nospecular, were used for the "projected shadows" or lights used to project fake "shadows" unto surfaces, this was used in Doom 3 to simulate basic, shadow mapping, for rotating fans and grid materials that use alpha textures, all because stencil shadows ignore those. Now that TDM has real shadow mapping, IMO such lights are less necessary and I wouldn't recommend their use for such effect.

Thou lights with no specular and no normal mapping, are still useful for some effects, like simulating casting colored light from painted glass, like something bellow, and they are faster then normal lights:

800px-Projected_texture.jpg&f=1&nofb=1&i

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Baal said:

I replaced the moonlight setup in Collateral with a global parallelSky light. It seems to work as expected and is much easier to setup. Cool.

 

@stgatilov

The moon light entities had "nodiffuse" set to 1. I don't remember why. What effect does this have?

"nospecular" was also set. Does this have a noticeable performance impact?

To my knowledge, "nodiffuse" doesn't currently work, "nospecular" saves a small amount of performance but is mostly used to give a flat appearance similar to the old ambient light.

  • Thanks 1

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • JackFarmer

      @joebarnin
      Jeff, I sent you PM a few weeks back but you did not respond. Maybe your inbox is full?
      · 5 replies
    • The Black Arrow

      I was playing Skyrim, got bored fast. Got back to The Dark Mod just for one mission, played "Somewhere above the City" which is not really a great mission but still good, as in above-average.
      My biggest regret is living in this country, where there's a heat wave, I am sweating at 20c and I really wish for temperatures below 5c.
      · 10 replies
    • Skaruts

      Is there something wrong with the forums lately, or is it my browser? I've been having trouble formatting posts, and just now I couldn't format anything at all.
      I'm using Vivaldi.
      Usually I have to: select text, click bold, nothing happens, select again, click bold, then it works. 
      Same for other stuff, like creating spoilers, bullet points, links. Nothing works the first time. 
      · 1 reply
    • STiFU

      Back from a spontaneous 1-week trip to Lanzarote with wife and son. I hope beta testing has been going well...
      · 1 reply
    • datiswous

      Whenever I eat fried chicken these days I think of this scene in The Black Mage..

      · 1 reply
×
×
  • Create New...