Try downloading the latest version of relighting (v4.0158b as of this writing).
Relighting v4.0165b - blurry shadows w/ rlassets
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
-
- Posts: 219
- Joined: Fri Nov 03, 2017 6:05 pm
-
- Posts: 448
- Joined: Tue Oct 18, 2022 1:59 am
- Operating System Version (Optional): Windows 11
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Relighting v4.0158b - optimizations
v4.0159b - progress
In addition to what's already been noted (I expanded the lifespan optimization), I discovered and fixed a bug (possibly a GZDoom bug) where a player finishing a level doesn't generate a shadow in the next. The PostBeginPlay() function doesn't fire automatically for a new inventory item. I keep finding stupid and obvious things, such as using persistent integer instead of new double comparisons within a loop, and tagging Flashlight sources on spawn. These changes slightly improve performance depending, and certainly don't hurt it.
There's still plenty of work to do. Many thanks for your support and input. I'm amazed at what has been possible thus far! I certainly would not have dipped into ZScript modding again without continued interest from this great community!! Currently pondering shadow flickering.
Release "soon"
Code: Select all
v4.0159b
3/27 - adjust sprite min/max by number of sprites (optimize)
3/28 - double shadow lifespan for actors > 1/4, 1/2, 3/4 distance (optimize)
3/29 - fixed DIV/0 error line 1321
3/30 - fixed shadow generating bug for player when finishing a level
3/30 - hd_shadow.zs: int tests for distance; args[0] for isFlashlight;
There's still plenty of work to do. Many thanks for your support and input. I'm amazed at what has been possible thus far! I certainly would not have dipped into ZScript modding again without continued interest from this great community!! Currently pondering shadow flickering.
Release "soon"
-
- Posts: 9
- Joined: Fri Mar 17, 2023 3:40 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Debian Stable 12
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Relighting v4.0158b - optimizations
Nope, but I'll try redownloading relighting again and PB again. Not sure why this is an issue, but I guess we'll see what happens. Thanks for looking into it regardless!Hey Doomer_ wrote: ↑Thu Mar 30, 2023 3:30 amThis loads fine on my end using PB v8.5 and Relighting v4.0158. Line 1754 is this:Kanok wrote: ↑Thu Mar 30, 2023 12:17 am Sorry it took me so long to get back to you on this. I actually posted it earlier, but it was probably missed. Either way, here is the current output. This is with the latest version of PB and your mod.
TITLEMAP - PB_Introduction
VM execution aborted: division by zero.
Called from hd_relighting_EventHandler.WorldThingSpawned at relighting v4.0157b.pk3:zscript/hd_relighting_eventhandler.zs, line 1754
Not sure where a DIV/0 is coming from. Indeed this line doesn't fire for me in TITLEMAP. Are you running a different version of PB or using any PB add-ons?Code: Select all
ptr.Scale.Y = rl_Cvar.rl_sector_light_scale.GetFloat() * clamp(e.thing.CurSector.LightLevel / (sky_light + 1), 0.5, rl_Cvar.rl_sector_light_scale.GetFloat() * 1.1);
EDIT:
Yep, seems the absolutely latest version is now working! Thanks for this wonderful mod and I look forward to using it. Not sure what changed, but hey, it's working now!
-
- Posts: 65
- Joined: Sun Jun 24, 2018 10:09 pm
Re: Relighting v4.0158b - optimizations
I just wanted to throw some fanboy praise your way and say that this mod is absolutely amazing. Shadows in their various iterations prior always have looked out of place in doom to me, until this mod. Extremely well done. I remember playing doom back in the 90s on the family 486sx pc late at night and in a dark living room. I experienced moments of sheer terror as I was completely immersed, particularly in maps where the light was low, even strobing in sections, as barely visible specters and other demons growled in the unknown distance. Captivating and nerve wracking in all of the right ways. I think I enjoyed those moments even more than the cacophonous ruckus of the all out fire fights and slaughters. I was young then and those moments have been very few and far between since. This mod manages to help me capture that experience all over again at times. Even though the lighting and effects are leaps and bounds ahead of what they were back then, I still find myself lost in nostalgia at the mood and atmosphere this helps to recreate. Sure, it isn't how things really were, but it is spot on how my imagination influenced my memory of those things to be. An absolutely brilliant little gem you've created here and I sincerely thank you for it. Can't wait to see what's next.
-
- Posts: 448
- Joined: Tue Oct 18, 2022 1:59 am
- Operating System Version (Optional): Windows 11
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Relighting v4.0158b - optimizations
Progress v4.0159b
Many, many corrections and simplifications to calculations. Some lighting calculations that were hard coded are now linked to CVars. I've also improved placement and identification of sector light sources and improved how lighting dissipates beyond a sector when baking textures. While I haven't added any lighting, existing lighting is better used. This is noticeable, for example, at the start of MAP01 and many other areas.
None of this is perfect, and there are anomalies where a few textures are oddly lit (E2M2 crates here and there) or shadows flicker. Shadows flicker depending on the visibility of a light source (and possibly the iterator itself); LineTrace relies on a point-to-point test, so it's pretty easy to block a light source with geometry. I've improved this somewhat with offsets, but it ends up being a performance tradeoff. The LineTrace for a shadow to "see" a light source is done every few tics for each light source within range. That's just expensive and scales only so well.
However, these bug corrections have corrected shadows in areas where they previously pointed in odd directions:
E1M5 - note how the imp shadows now point correctly away from the window
E1M2 - shadows point and lengthen correctly
E1M2 - similar correction around the corner of the building
These are all positive changes that improve visuals without hurting performance. Still testing, but so far it looks great.
Funny how a POC for dynamic shadows posted on Discord threw me down this rabbit hole. Doom almost seems like a new game with Relighting, at least to me. But I am biased.
Release "soon."
Many Many Thanks for support and kudos! I appreciate it!!
Code: Select all
v4.0159b
3/27 - adjust sprite min/max by number of sprites (optimize)
3/28 - double shadow lifespan for actors > 1/4, 1/2, 3/4 distance (optimize)
3/29 - fixed DIV/0 error line 1321
3/30 - fixed shadow generating bug for player when finishing a level
3/30 - hd_shadow.zs: int tests for distance; args[0] for isFlashlight; z calc in LightCheckSight; (bugs)
4/1 - light calculations linked to CVars (accuracy)
4/2 - fixed hdspot added hdlightsources (accuracy)
4/3 - corrected Pos.z for temp hd_lightsource & corrected LightSightCheck functions (accuracy / optimize)
None of this is perfect, and there are anomalies where a few textures are oddly lit (E2M2 crates here and there) or shadows flicker. Shadows flicker depending on the visibility of a light source (and possibly the iterator itself); LineTrace relies on a point-to-point test, so it's pretty easy to block a light source with geometry. I've improved this somewhat with offsets, but it ends up being a performance tradeoff. The LineTrace for a shadow to "see" a light source is done every few tics for each light source within range. That's just expensive and scales only so well.
However, these bug corrections have corrected shadows in areas where they previously pointed in odd directions:
E1M5 - note how the imp shadows now point correctly away from the window
E1M2 - shadows point and lengthen correctly
E1M2 - similar correction around the corner of the building
These are all positive changes that improve visuals without hurting performance. Still testing, but so far it looks great.
Funny how a POC for dynamic shadows posted on Discord threw me down this rabbit hole. Doom almost seems like a new game with Relighting, at least to me. But I am biased.
Release "soon."
Many Many Thanks for support and kudos! I appreciate it!!
-
- Posts: 448
- Joined: Tue Oct 18, 2022 1:59 am
- Operating System Version (Optional): Windows 11
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Relighting v4.0158b - optimizations
Progress v4.0159b
Quick update, since I keep finding bugs.
I've corrected more calculations in lighting related to sector volume and height. This means lighting responds appropriately to changes in Settings. A few areas seem more realistic, at least to me.
I've also separated baked lighting from sector lights. The baked lights have no impact on performance and (if desired) can now be disabled by setting add and subtract values to 0. This is simple change you can try yourself to see the baked lighting if you have sector lighting disabled by changing line 1264 in zscript\hd_relighting_EventHandler.zs from this:
to this:
If you use Relighting with sector lights turned off you should see the difference.
Finally I've further tweaked calculations for temporary lighting on 2-sided lines in sectors that have a light source. This adds more light here and there, does not impact performance at all (these light sources are temporary and are destroyed at the end of WorldLoaded), and makes some shadows more dramatic as seen here. Note the critters are in the shade of their own shadow and the shadow of the shotgun guy looms in the foreground. This kind of thing should now be more visible.
I've reviewed my own settings in GZDoom. I code and test in Sector Dark mode with shadow mapping and ambient occlusion disabled. For my taste shadow mapping contains too many banding artifacts, and ambient occlusion seems like an expensive gimmick. But that's my preference. I don't think turning those on will make the mod look worse.
Should release by Saturday (assuming I don't discover more bugs!).
Quick update, since I keep finding bugs.
I've corrected more calculations in lighting related to sector volume and height. This means lighting responds appropriately to changes in Settings. A few areas seem more realistic, at least to me.
I've also separated baked lighting from sector lights. The baked lights have no impact on performance and (if desired) can now be disabled by setting add and subtract values to 0. This is simple change you can try yourself to see the baked lighting if you have sector lighting disabled by changing line 1264 in zscript\hd_relighting_EventHandler.zs from this:
Code: Select all
if (rl_Cvar.rl_sector_lights.GetBool())
Code: Select all
if (rl_Cvar.rl_sidedef_add.GetInt() > 0 && rl_Cvar.rl_sidedef_subtract.GetInt() > 0)
Finally I've further tweaked calculations for temporary lighting on 2-sided lines in sectors that have a light source. This adds more light here and there, does not impact performance at all (these light sources are temporary and are destroyed at the end of WorldLoaded), and makes some shadows more dramatic as seen here. Note the critters are in the shade of their own shadow and the shadow of the shotgun guy looms in the foreground. This kind of thing should now be more visible.
I've reviewed my own settings in GZDoom. I code and test in Sector Dark mode with shadow mapping and ambient occlusion disabled. For my taste shadow mapping contains too many banding artifacts, and ambient occlusion seems like an expensive gimmick. But that's my preference. I don't think turning those on will make the mod look worse.
Should release by Saturday (assuming I don't discover more bugs!).
-
- Posts: 448
- Joined: Tue Oct 18, 2022 1:59 am
- Operating System Version (Optional): Windows 11
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Relighting v4.0158b - optimizations
Just a POC compatibility hack for the beamflashlight mod, a non-spotlight flashlight that fires light projectiles.
No idea how many people use this, but it works well enough with Relighting and looks cool.
Edit
Liking this more and more! Another example.
Note I haven't touched this flashlight mod at all. Relighting allows for a flashlight made of light projectiles (the missile origin is the light origin, etc) with three or four lines of added code to ensure shadows point correctly. Simple.
One benefit is multiple shadows can overlay, which "blurs" them. Another feature of this flashlight mod is surfaces are lit dynamically, and Relighting automatically adds more light to the mod. At this point no performance hit. Still testing, but it looks amazing combined with Relighting.
No idea how many people use this, but it works well enough with Relighting and looks cool.
Edit
Liking this more and more! Another example.
Note I haven't touched this flashlight mod at all. Relighting allows for a flashlight made of light projectiles (the missile origin is the light origin, etc) with three or four lines of added code to ensure shadows point correctly. Simple.
One benefit is multiple shadows can overlay, which "blurs" them. Another feature of this flashlight mod is surfaces are lit dynamically, and Relighting automatically adds more light to the mod. At this point no performance hit. Still testing, but it looks amazing combined with Relighting.
-
- Posts: 878
- Joined: Tue May 07, 2019 12:24 pm
- Graphics Processor: nVidia with Vulkan support
Re: Relighting v4.0158b - optimizations
I used to use that flashlight but it becomes real scuffed in online scenarios unfortunately.
maybe an optimal flashlight function built into relighting is the next big project?
maybe an optimal flashlight function built into relighting is the next big project?
-
- Posts: 448
- Joined: Tue Oct 18, 2022 1:59 am
- Operating System Version (Optional): Windows 11
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Relighting v4.0159b - better light & shadow
Posted v4.1059b - better light & shadow
In addition to the above there are the following changes:
The skewness correction ensures greater compatibility with more detailed maps (such as My House) without changing defaults. Overall this version has many bug fixes that increase the lighting accuracy. No new features except for compatibility with beamflashlight.
In addition to the above there are the following changes:
Code: Select all
4/4 - separated baked sidedef block from rl_sector_lights
4/6 - added smart lighting for brighter sector light sources
4/7 - added support for beamflashlightmod
4/8 - corrected skewness upper clamp to allow for min_area > max_area
-
- Posts: 448
- Joined: Tue Oct 18, 2022 1:59 am
- Operating System Version (Optional): Windows 11
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Relighting v4.0158b - optimizations
Good idea.Dan_The_Noob wrote: ↑Sat Apr 08, 2023 1:20 am I used to use that flashlight but it becomes real scuffed in online scenarios unfortunately.
maybe an optimal flashlight function built into relighting is the next big project?
I'm also pondering that or perhaps a variation for decorative lighting.
Beamflashlight works well with Relighting because it fires nineteen separate projectiles, each of which gets an hd_light attached to it. Hd_lights add point lights and are added to shadow iterators. I'll bet more is possible with this idea. Light scatters when it hits a surface, and I'm curious if this could cheaply generate geometric shadows.
For example there is this. Maybe a middle ground for decorative lighting is practical.
Edit
Messing around with beamflashlight. The angle of custom missiles in this mod is 0 and NOCLIP is set for the actor. So no obvious deflection for a flashlight. The mod fires successively faster projectiles with larger point lights attached, but the base actor state stops quickly. Changing State tics in the beamflashlight mod's decorate code is something to try:
Code: Select all
States
{
Spawn:
TNT1 AABC 1 ///////////////// <- change this number
Stop
}
MAP01 - changed to 2
I've no intention of changing this flashlight mod - which is pretty cool by itself! - but I think there is enough here to suggest new lighting ideas. Maybe a different flashlight and/or decorative lighting.
-
- Posts: 123
- Joined: Wed Nov 11, 2020 3:25 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Brazil
Re: Relighting v4.0159b - better light & shadow
How are the "baked lightmaps" supposed to look? i've been messing about with those settings in the first level of nerve.wad and i swear i cannot notice a difference, maybe it's a Delta Touch thing? i don't know.
-
- Posts: 448
- Joined: Tue Oct 18, 2022 1:59 am
- Operating System Version (Optional): Windows 11
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Relighting v4.0159b - better light & shadow
Baked lighting is controlled by Sidedef Add/Sub Lights sliders; if both are zero the feature is now turned off. (Previously all this was linked to Sector Lights toggle that adds lighting from missiles passing through a sector and door light switching.) In many sectors light sources add or subtract light from textures based on the inverse square law. It does a few other things as well, such as adding decorative light sources for baking and shadows.generic name guy wrote: ↑Sat Apr 08, 2023 7:36 pm How are the "baked lightmaps" supposed to look? i've been messing about with those settings in the first level of nerve.wad and i swear i cannot notice a difference, maybe it's a Delta Touch thing? i don't know.
Baking also turns off fake contrast, which lights all textures in one direction, and uses "smooth lighting" where applied. Depending on the map and amount of light added by Relighting the effect is more or less noticeable.
Examples:
e2m2 (bake)
e2m2 (no bake)
map15 (bake)
map15 (no bake)
This is also noticeable in more subtle ways compared to fake contrast - such as lighting stairways (E1M9) and sides of columns (E2M5) - but that's the idea. It does produce anomalies here and there, and note that side tiers are not available in ZScript.
No performance impact in game, since it's all done in WorldLoaded. Hope that helps!
-
- Posts: 57
- Joined: Sun Oct 04, 2020 6:43 pm
Re: Relighting v4.0159b - better light & shadow
Fantastic job on the latest update, absolutely incredible work.
-
- Posts: 362
- Joined: Mon Mar 25, 2013 11:47 am
Re: Relighting v4.0159b - better light & shadow
If I'm finding maps to be too dark in general, which sliders can I adjust to keep the dramatic lighting but make everything less dark?
-
- Posts: 448
- Joined: Tue Oct 18, 2022 1:59 am
- Operating System Version (Optional): Windows 11
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Relighting v4.0159b - better light & shadow
Good question.
Short answer is it all depends. The old Relighting started without any lighting. This one starts with the author's lighting and adjusts that according to a number of variables. I haven't gotten around to creating presets.
But I'll do my best to answer this.
Relighting does make "volume" adjustments to large or tall sectors that are already dark (on the notion that darkness deepens in gloom), and there are a few other settings that are not exposed in menus.
What is exposed in Settings can affect lighting, but it all depends on the map. Light sources are placed based on the original light of the sector (ignoring light specials where lighting constantly changes) and area. Under Sector Light Placement and Size you can try changing the min (e.g. 40) and max (e.g. 1024) areas where light sources are placed, and you can increase Scale (e.g. 2.5). Generally light is placed and visible according to those variables.
Boring stuff that may help explain what's going on:
Light placement is influenced by map design as min and max numbers are not absolute; they select areas to determine a distribution. This varies significantly, even in canonical maps. The minimum area threshold is adjusted by the skew (tail) of the area curve to avoid unnecessary light sources. This helps performance by eliminating lights in detailed maps. Regardless only one sector light source is placed in each sector at a "point of inaccessibility," that is the point farthest from all other points. And that is needed because larger sectors tend to be irregular - often highly so - polygons.
Since light dissipates exponentially (imagine an expanding sphere), increasing Scale means more light is seen for a somewhat farther distance. This all depends on light placement, level geometry, original lighting, etc. Smart lighting adjusts this by sky vs. indoor lighting and other tweaks. Sector lighting is further adjusted by the amount of light "seen" by textures in that sector. Increasing Scale will also increase the size of dynamic lighting, so it's a performance tradeoff.
Under How Light Interacts with Map the settings for Sidedef Add Lights and Sidedef Sub Lights affect how much light textures add or remove. Increasing the above scale and the Add Lights setting should - assuming the light source is visible - increase the amount of visible light. Sidedef lighting depends on sector lighting as well.
Decorative lighting is adjusted by the perceived brightness of the color emitted using standard digital display calculations. The settings controlling this are in Adding/Reading Color Options. It might be interesting to adjust those sliders, although that depends on the colors in use. Generally the human eye perceives green as brighter and closer to the eye than blue, for example. This is accounted for in the color calculations in these settings and in the shader.
Having said all that, this is still a work in progress and I've likely missed how some variables are applied or accounted for. Still finding bugs.
I've also described the above as I understand these issues, but I'm just a programmer. I know next to nothing about photography and a wee bit more than that about physics. If anything is inaccurate, please comment to increase my understanding, and please feel free to make suggestions. I've tried to apply concepts as they seem to fit.