Relighting v4.0165b - blurry shadows w/ rlassets

Projects that alter game functions but do not include new maps belong here.
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.
cosmos10040
Posts: 177
Joined: Mon Dec 20, 2021 6:16 am
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Relighting v4.0154b - subtractive shadows

Post by cosmos10040 »

I also got a vm abort in delta touch but forgot to report it. I will load it up today and report back.

Edit: here's the log:

VM execution aborted: division by zero.
Called from hd_relighting_EventHandler.WorldLoaded at relighting v4.0154b.pk3:zscript/hd_relighting.zs, line 1512
]
User avatar
Hey Doomer_
Posts: 403
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.0154b - subtractive shadows

Post by Hey Doomer_ »

More wall shadows

Making progress on this idea. Shadows are cast farther and wider depending on the distance from the light source. This may look odd since sprites can't be clipped, but on the whole this is looking pretty cool. 8-)

Examples:

e1m1 (brightened)
e2m2

This doesn't really change the wall shadow code. It just allows for casting wall shadows at a longer distance than the length of the floor shadow and in adjacent sectors. It doesn't allow for the direction or height of the light source at this time. I still have to work on alpha transparency issues, although I did add a separate CVar for wall shadow alpha transparency. While obviously adding WALLSPRITE actors, this doesn't appear to affect performance; these actors have a very short lifespan, don't contain a thinker, etc.

Many thanks for comments about pesky DIV/0 errors. I should have those fixed in the next release.
User avatar
Hey Doomer_
Posts: 403
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.0155b - long shadows

Post by Hey Doomer_ »

Posted v4.0155b - long shadows

I'm calling these "long" shadows in options, but really a few things are involved:
  • Wall shadows are cast at greater (long) distances across sectors
  • Wall shadows are larger, generally
  • Wall shadows cast on lower and upper (closed door) textures
  • Wall shadows have a separate alpha CVar
In previous versions wall shadows were cast mid-line only in the same sector when the floor shadow made contact with the wall.

Also fixed previously noted DIV/0 errors. I've tested this with most Doom maps, a few Heretic and Hexen maps, and a handful of custom maps. Let me know what you think!
DarkkOne
Posts: 270
Joined: Mon Jun 06, 2016 11:26 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Widnows 11
Graphics Processor: nVidia with Vulkan support

Re: Relighting v4.0155b - long shadows

Post by DarkkOne »

Get DIV/0 errors with Hedon.
User avatar
Hey Doomer_
Posts: 403
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.0155b - long shadows

Post by Hey Doomer_ »

DarkkOne wrote: Thu Mar 02, 2023 4:42 pm Get DIV/0 errors with Hedon.
OK thanks. Please be more specific and I'll check it out.
DarkkOne
Posts: 270
Joined: Mon Jun 06, 2016 11:26 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Widnows 11
Graphics Processor: nVidia with Vulkan support

Re: Relighting v4.0155b - long shadows

Post by DarkkOne »

Hey Doomer_ wrote: Fri Mar 03, 2023 5:34 am
DarkkOne wrote: Thu Mar 02, 2023 4:42 pm Get DIV/0 errors with Hedon.
OK thanks. Please be more specific and I'll check it out.
I mean, they happen upon boot. Hedon is an IWAD, no other mods added, no other wads loaded other than gzdoom's defaults. This is in Gzdoom 4.10.0. You can't even access the menu, it happens before then, and if you hit escape to try to bring up the menu, it just flickers briefly and takes you back to the console with the error message again. I didn't include a lot of information, because there's really just nothing to include, it happens instantly with nothing additional included.
User avatar
Hey Doomer_
Posts: 403
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.0155b - long shadows

Post by Hey Doomer_ »

DarkkOne wrote: Fri Mar 03, 2023 10:15 am
Hey Doomer_ wrote: Fri Mar 03, 2023 5:34 am
DarkkOne wrote: Thu Mar 02, 2023 4:42 pm Get DIV/0 errors with Hedon.
OK thanks. Please be more specific and I'll check it out.
I mean, they happen upon boot. Hedon is an IWAD, no other mods added, no other wads loaded other than gzdoom's defaults. This is in Gzdoom 4.10.0. You can't even access the menu, it happens before then, and if you hit escape to try to bring up the menu, it just flickers briefly and takes you back to the console with the error message again. I didn't include a lot of information, because there's really just nothing to include, it happens instantly with nothing additional included.
I don't see any such errors in the freeware version. Can you include a screenshot from the console? Thanks
DarkkOne
Posts: 270
Joined: Mon Jun 06, 2016 11:26 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Widnows 11
Graphics Processor: nVidia with Vulkan support

Re: Relighting v4.0155b - long shadows

Post by DarkkOne »

https://imgur.com/a/dbR4MFs

Yeah, I have the Steam version, so the free version may not have the issue. Here's the screenshot.
User avatar
Hey Doomer_
Posts: 403
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.0155b - long shadows

Post by Hey Doomer_ »

WIWO for v4.1056b - window lights

This is similar to the "window grid lights" in the old Relighting with more utility. Example:

e1m5-windowlight

This adds a spotlight in a window pointing away from the light source and adds an hdlightsource actor that only affects shadows. It is in effect another layer of lighting that does something different. The effect is a subtle lighting of textures as well as wall shadows. This doesn't happen very often (a few times a map, since it requires a window to the outside) but looks really cool. Doesn't seem to affect performance. 8-)

Still testing.
User avatar
Hey Doomer_
Posts: 403
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.0155b - long shadows

Post by Hey Doomer_ »

DarkkOne wrote: Fri Mar 03, 2023 3:31 pm https://imgur.com/a/dbR4MFs

Yeah, I have the Steam version, so the free version may not have the issue. Here's the screenshot.
Many thanks, I'll check it out!
User avatar
Hey Doomer_
Posts: 403
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.0155b - long shadows

Post by Hey Doomer_ »

Hey Doomer_ wrote: Fri Mar 03, 2023 6:59 pm
DarkkOne wrote: Fri Mar 03, 2023 3:31 pm https://imgur.com/a/dbR4MFs

Yeah, I have the Steam version, so the free version may not have the issue. Here's the screenshot.
Many thanks, I'll check it out!
This is the skew function that measures the head or tail of the curve of sector areas. I've never seen this happen, but it either means there is only one sector (unlikely) and/or the standard deviation of the curve is zero (all sectors are the same size). Try this in the skew function (at the bottom of hd_relighting.zs):

Code: Select all

		if (n == 1 || sd == 0)
		{
			return 1.0;
		}
		else
		{
			return sum / ((n - 1) * sd * sd * sd);
		}
Let me know how that works. Thanks!
DarkkOne
Posts: 270
Joined: Mon Jun 06, 2016 11:26 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Widnows 11
Graphics Processor: nVidia with Vulkan support

Re: Relighting v4.0155b - long shadows

Post by DarkkOne »

Seems to work. Don't have time for any detailed testing, but I was able to start the game and see new lighting, so it at least gets past the obvious issue.
User avatar
Hey Doomer_
Posts: 403
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.0155b - long shadows

Post by Hey Doomer_ »

Progress v4.0156b

I'm making progress on the next version.

Code: Select all

v4.0156b

3/4 - fixed DIV/0 in skew function
3/4 - added window lights, post baking hdlightsources for wall shadows
3/4 - added alpha adjustment for elevated floor shadows
3/7 - added CVar for player shadows on self
Also many bug fixes and small optimizations but nothing that changes performance.

"Window" is loosely defined as a sector where surrounding floors are the same or lower within sight of an existing non-decorative light source. This happens post play, so these additional light sources do not affect baking but do affect wall shadow generation. Additionally I add a spot light pointing opposite and in magnitude of the exterior light source, taking into account a few other variables. And that is where things start to get interesting:

map02

Note the angled shadow on the building's corner (a random example; this happens here and there). Ain't that something. I assume this is a visual anomaly of colliding spots - there are spots on the stairs and in both building entries. I can't remember ever seeing this in GZDoom. Looks cool. 8-)

Other than that I experimented with a POC of geometry shadows using crates in E2M2. This works, including wall shadows, but the FLATSPRITE Z-sorting bug makes it impractical. So that is shelved for now.

Still testing. Should release soon. 8-)
DarkkOne
Posts: 270
Joined: Mon Jun 06, 2016 11:26 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Widnows 11
Graphics Processor: nVidia with Vulkan support

Re: Relighting v4.0155b - long shadows

Post by DarkkOne »

How is it decided which surfaces are reflective? Are they manually assigned, or is there some property or flag that's used? (I know _so_ little about Doom engine stuff).

Playing through non-Doom games I was occasionally seeing textures that I didn't expect to be reflective, be reflective, and in Strife some water is, and some isn't. So I was wondering if this is something where like... more information for a hard-coded list would be beneficial, or if it's just a case where "wad authors should flag things better" or something.
User avatar
Hey Doomer_
Posts: 403
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.0155b - long shadows

Post by Hey Doomer_ »

DarkkOne wrote: Fri Mar 10, 2023 5:04 pm How is it decided which surfaces are reflective? Are they manually assigned, or is there some property or flag that's used? (I know _so_ little about Doom engine stuff).

Playing through non-Doom games I was occasionally seeing textures that I didn't expect to be reflective, be reflective, and in Strife some water is, and some isn't. So I was wondering if this is something where like... more information for a hard-coded list would be beneficial, or if it's just a case where "wad authors should flag things better" or something.
Generally I've avoided hard-coded lists to make the mod universal. Reflective textures are actually the one exception. I'll do my best to explain how it works.

The mod controls reflections with a few menu options. Sectors with the same floor texture are tagged with the same unique number. This means that a tagged floor is reflective in the same way throughout a particular map. At present all known floor animation textures are reflective to a degree, and reflections are based on the perceived brightness of the flat (floor texture). The menu option "Reflection Value" is the perceived brightness cutoff.

Perceived brightness is calculated from weighing red, green, and blue components of color palette values (green is perceived as brighter than blue, etc). I use one of two formulas (developed by the video industry called BT.601 and BT.709) depending on the amount of green. I also return values for "how" red, green, and blue the color is that is based on menu options under "Perceived Light." Those values broadly determine how colors are recognized and processed by the mod. This in turn affects colored sectors, reflections, and anything else referencing color.

Animated textures (and pretty much everything else!) are not named consistently and so are taken from here (the only referenced textures in the mod) and from ANIMDEF lumps. Flats are easier to interpret as they are designed to be tiled. Each pixel has a value corresponding to the last color palette loaded (either the default for the game or a modded palette), and those are averaged according to brightness, how red, how green, and how blue. If a color isn't bright, red, green, or blue enough it's ignored, and the flat itself may be ignored. Crude but fast.

Mind you all this is based on the original Doom map specs and expected texture formats that work in Doom and related games, including Heretic, Hexen, Strife, etc. I'm still on the fence about reading colors in textures other than sky textures. That can be done easily enough, but wall textures generally contain information that is pattern based. Reading patterns is much harder than averaging colors in something like a tiled flat or sky. There are also only a dozen or so flats in any one level; reading and analyzing all textures on load would be more expensive. Not impossible... just haven't made up my mind about it. :|

Anyway, short answer to manage reflections is to change the Reflection and color values in the mod menu. Color palette mods may also change the effect.

Hope that helps!

Return to “Gameplay Mods”