Relighting Doom v3.31b [Updated 4/8/22]

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.
Post Reply
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Re: Relighting Doom v2.49b [Updated 1/29/22] w/ Light Grids

Post by Hey Doomer »

mamaluigisbagel wrote:Its the fact the liquid has a reflection. I dunno, it just makes me think you can dive in the water sometimes because it looks deeper than it actually is.
Odd, I don't see that. FYI reflections can be commented out or changed in strength in the rl_reflections.txt lump.

I also noticed this area seems extremely bright; I believe the same texture is defined in both rl_textures and rl_gldefs. For the next version I've added a final adjustment to bright sector light level based on the number of texture-attached dynamic lights to give the latter more emphasis if they are used, a subtle but more realistic effect.
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Re: Relighting Doom v2.49b [Updated 1/29/22] w/ Light Grids

Post by Hey Doomer »

For the next update (probably tomorrow) I have the following at least:
  • added support for multiple definition lumps and map-specific definitions
  • added a final adjustment to "bright" sector light levels after texture dynamic lights are added
Adding a color can make a huge difference, I find. If a sector has no visible light sources, it'll be pitch dark anyway, so it makes sense to pick a texture and apply a dark color. Below I've added "mocha" to RROCK09, a ceiling texture in MAP06:

https://i.postimg.cc/tgQVt5vF/Screensho ... 054158.png

Here's the addition to rl_flats.txt (in the pk3, can be edited in Slade):

Code: Select all

; mocha
RROCK09,#493d26
This looks almost like Quake, doesn't it? I found this unexpected, but it's really a combination of sector lighting, color, and dynamic lights working together. No performance hit. I'll be looking at these issues as well, avoiding specific exceptions (although these are possible in the next release).
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Re: Relighting Doom v2.5b [Updated 1/31/22] w/ Color Control

Post by Hey Doomer »

After falling down a few rabbit holes (reading lumps and others), I've posted v2.5b with a few more tweaks and features.
  • Added a final adjustment to sector brightness after adding dynamic texture lights. Makes sense, right?
  • Brighten or darken color definitions. These are based on whatever formula is chosen. Correspondingly sectors will be darker or brighter.
  • Added glow for floor flats with the height based on the perceived brightness of the color. The glow color is the sector color attached to the flat brightened 25%.
I wrote a Python script to show the differences in color lightening vs. brightening, and emphasizing (or de-emphasizing) colors our eyes are more sensitive is very interesting to see. That certainly proved the concept, obvious or not. Relighting adds colors to sectors and dynamic lights with light levels and strengths that correspond to perceived color brightness. This isn't my field, but it makes sense that color and light are the same thing (one reflected and one not). Can't have one without the other.

Two examples:

https://i.postimg.cc/tTQr3FXG/Screensho ... 083141.png
https://i.postimg.cc/bJxm3dJD/Screensho ... 083622.png

These get beyond the realm of pretty to something realistic, I fancy. While a definition can be overridden in a text lump for any map there is NO exception programming. It's all based on definitions of light source colors. Let me know what you think!

Update:

PBR textures etc. are interesting but don't change the sprites and other visuals. I don't think the vanilla assets look terrible with Relighting at all, and in any case custom textures from other mods look jarring. Question is, what's reasonable? Is it better for a few textures to stand out, or is it all or nothing? So I'm experimenting with only a few normal and specular maps on textures that should be shiny:

https://i.postimg.cc/8kqvkSTs/Screensho ... 150453.png
https://i.postimg.cc/vZMwscjh/Screensho ... 152059.png
https://i.postimg.cc/xdcpmz49/Screensho ... 155806.png
https://i.postimg.cc/zDtjCBTB/Screensho ... 160009.png
Kazudra
Posts: 126
Joined: Mon May 25, 2015 10:52 am

Re: Relighting Doom v2.5b [Updated 1/31/22] w/ Color Control

Post by Kazudra »

This is looking like a perfect blend of PC and PSX Doom and I'm loving it.

Though I do have one minor nit-pick; GL Skyboxes (viewtopic.php?f=46&t=53873&hilit=doom+skyboxes) break all sky lighting.
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Re: Relighting Doom v2.5b [Updated 1/31/22] w/ Color Control

Post by Hey Doomer »

Kazudra wrote:This is looking like a perfect blend of PC and PSX Doom and I'm loving it.

Though I do have one minor nit-pick; GL Skyboxes (viewtopic.php?f=46&t=53873&hilit=doom+skyboxes) break all sky lighting.
Thanks! And thanks for mentioning sky boxes. I'll have that fixed by next release. Forgot completely about those. :shock:
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Re: Relighting Doom v2.51b [Updated 2/1/22] w/ N/S Maps

Post by Hey Doomer »

Just posted v2.51b. :D

This is a small update that I spent way too much time on. I've added obviously shiny material normal and specular maps, which need dynamic lights. I wondered if a few shiny textures here and there would make a difference, and I've been pleased with results (Example). Adding this to NUKAGE flats is especially effective as seen here in E1M6.

In addition to making the adjustment for light level after dynamic lights are added, color is also darkened proportionally. This avoids making sectors with added dynamic lights appear brighter than they should be, if that makes sense.

Color and light continue to work together well with surprising results. Here all I did was add this to the rl_textures lump: METAL3,#cd7f32. And here you can see the surprising effect of the new maps. Looks like Quake.

I've discovered this also creates new lighting effects, which is especially interesting. In MAP02, for example, I noticed this before and after. This is no added code. It's done somehow (haven't figured that out) by lump definitions. (There is no exception coding for anything.) Anyway, quite a surprise.

Here's another screenshot from E1M4 showing everything working together. Honestly I never thought anything like this was possible using ZScript. Quite remarkable and a compliment to the engine as well as Romero's design. I've avoided adding anything for any specific maps.

Please let me know what you think!
User avatar
mamaluigisbagel
Posts: 526
Joined: Wed Jul 09, 2014 7:25 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support

Re: Relighting Doom v2.51b [Updated 2/1/22] w/ N/S Maps

Post by mamaluigisbagel »

Out of curiosity, is it possible to have the mod tell what is a texture and what is liquid? I think Doom already does that (since liquid is animated) and I'd assume maybe it'd be possible to add options to toggle texture and liquid reflections individually? I'm not a modder so I can't say I know what I'm talking about, just throwing ideas around. Also sorry if I'm reporting or posting non-helpful stuff too much, just trying to help any way I can.

I like the new update so far, though I did immediately see the nukage lighting which could look nice, but to me makes it look more like a texture than a liquid. Pet peeve, I guess.
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Re: Relighting Doom v2.51b [Updated 2/1/22] w/ N/S Maps

Post by Hey Doomer »

mamaluigisbagel wrote:Out of curiosity, is it possible to have the mod tell what is a texture and what is liquid? I think Doom already does that (since liquid is animated) and I'd assume maybe it'd be possible to add options to toggle texture and liquid reflections individually? I'm not a modder so I can't say I know what I'm talking about, just throwing ideas around. Also sorry if I'm reporting or posting non-helpful stuff too much, just trying to help any way I can.

I like the new update so far, though I did immediately see the nukage lighting which could look nice, but to me makes it look more like a texture than a liquid. Pet peeve, I guess.
Possibly. What is it you want to see happen?

I noticed this also, and this can be changed in the GLDEFS lump that defines specularlevel for each texture. What I did was change NUKAGE2 (doesn't matter which) to 3.5. This simulates natural light better, I think, and of course you can change those values to anything you prefer. You can also change the reflection amount by changing the value in rl_reflections.

It doesn't look as though the GLDEF values can be changed with ZScript. (Or can they? I honestly don't know, but I didn't find anything obvious in a quick search.)

Other than that, Relighting primarily looks at textures in the WorldLoaded event. There's nothing done real time. A more knowledgeable person would have to confirm this, but it seems like the engine decides what's animated or not by lump names. On the map it's called NUKAGE3; I assume it knows it is animated because there are lumps called NUKAGE1 and NUKAGE2, but it's been many years since I created a map. That's not to say Relighting can't do something different with these, if they were so defined in the mod.

Update:

Adding glossiness. Likely small update tomorrow.
Kazudra
Posts: 126
Joined: Mon May 25, 2015 10:52 am

Re: Relighting Doom v2.51b [Updated 2/1/22] w/ N/S Maps

Post by Kazudra »

Parallax with this looks NICE.


Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Re: Relighting Doom v2.52b [Updated 2/2/22] w/ N/S Maps

Post by Hey Doomer »

Just uploaded v2.52b.

This version adds glossiness to the n/s textures. I looked through these pretty carefully, and I've only added those that seem to be likely near dynamic lighting.

I also noticed serious fps tanking in some areas of some maps. This was caused by too many dynamic lights in windows. I did two things: increased the strength of window lights according to the color of the light streaming in, and reduced the number of dynamic lights in windows by looking at various factors. The criteria for outdoor and indoor windows are now different. This reduces the dynamic lights and improves performance significantly in some areas, but it also creates some subtle effects:

Here and here MAP11 shows variation in lighting.

Areas such as this corner in E2M2 have light.

Finally this from E2M5 brings this together. Note the brighter walkway to the left (the one to the right off screen is darker) and reflection of the lights on the nukage. (Specularlevel altered slightly for nukage.) Overall this version adds more realism and improves performance.

Thanks for your comments and feedback. Let me know what you think!

Update:
For the next release I'm bringing back sector fog, defined in a separate text lump. Screenshot.
More n/s. Screenshot.

Update for v2.53b:
Still testing but in addition to fog I've added a simple shader to make colors brighter and more vibrant or darker and somewhat dingy. The default values are subtle but noticeable, simply applying the luma formula chosen in Settings to the pixel colors on the screen: Here and here. Release probably tomorrow.
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Re: Relighting Doom v2.53b [Updated 2/4/22] w/ Color Shader

Post by Hey Doomer »

Just uploaded v2.53b.
  • Added fog back as a separate definition lump, otherwise it works similar to as before with a slightly improved density calculation
  • Added n/s textures for water
  • Added a very basic shader that brightens or darkens colors according to Settings
I tweaked texture colors here and there and didn't touch dynamic light code (removed a few definitions). Performance is good I think. Window lights are interesting here, for example, but I also find they light floor and ceiling irrespective of height. Some areas are completely transformed, and it seems difficult for me to believe this is done with text files that list a color beside a texture. Again there is no exception programming for specific maps, although obviously I've selected textures and colors that seem logical. (It would be interesting if ZScript could read the images and calculate color.) This kind of stuff is just eye-popping and shows what GZDoom can do, I think.
User avatar
Enjay
 
 
Posts: 27080
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Relighting Doom v2.53b [Updated 2/4/22] w/ Color Shader

Post by Enjay »

Hmmm... with the new version I'm getting quite a bit of light level flickering in sectors that do not have any kind of flicker special. MAP01 of Doom2 can demonstrate this quite easily for me.

I find that if I run around the map for a bit and then come back to the starting area, I can trigger most of the time.

Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Re: Relighting Doom v2.53b [Updated 2/4/22] w/ Color Shader

Post by Hey Doomer »

Enjay wrote:Hmmm... with the new version I'm getting quite a bit of light level flickering in sectors that do not have any kind of flicker special. MAP01 of Doom2 can demonstrate this quite easily for me.

I find that if I run around the map for a bit and then come back to the starting area, I can trigger most of the time.
This could be the light sensor pause distance in Settings. Sensors beyond a certain distance from the player go into Pause or Dormant mode. That could be it depending on size and layout of the sectors and where the code puts the sensors. It's set low by default for performance reasons but can be increased. Initially all light levels are set and then these states are triggered by approximate distances from the player.

Other than that I'll check this out later. I don't think I changed anything related to this... but it's possible. :? Thanks for pointing this out!

Update: look like it is the distance to scan under Light Performance Settings. Investigating now.

Update: found a few problems in the light code, fixing and optimizing now. I suspect performance will be about the same but it will look better. As always thanks!
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Re: Relighting Doom v2.54b [Updated 2/5/22]

Post by Hey Doomer »

Just uploaded v2.54b with the following changes:
  • fixed the light code to directly measure distances and use a light gradient structure; this should eliminate most sector light glitching
  • added a PLR check for non-bright, "bright" sectors - this should improve that
  • added a compass direction in the menu for window light (southern exposure, etc.)
  • added "dark" shadows, basically blob shadows attached to the back of monsters in sectors where the DN3D shadows are harder to see
As I reworked much of the light code there were (naturally) many What was I thinking then? moments lol. I don't expect a performance hit, and if anything it may be better. The compass directions for window lights occurred to me about the same time. I tweaked the window code, which had been fudged to fix the broken light code, etc. For example E1M1 looks like this or this depending on the direction of the sun. Currently this isn't fancy and only uses four directions.

I replaced the light distance tweaks on the Settings menu with "Pause Distance," which controls how light sensors respond. That setting can still be tweaked to improve performance.

The "dark" shadows are so-called because they are in darker sectors; in bright sectors the engine sprite shadows are generally fine. Looks like this. Nothing fancy and in beta, but it addresses a peeve.

You'll notice the lighting is different in some areas. This is a few things. One is the previous code decreased light as an exponential function of distance, more or less, and this new code measures a distance and pulls variables from a preloaded structure array. Marker and sensor placement has not changed, but the number of window lights has been decreased in some areas and increased in others, depending. I'm still not crazy about the window light code, but I'll work on that. Finally, I think the sensors themselves are generally more responsive (still working on a few glitches).

Thank you for your comments and help, always appreciated. Let me know what you think!
ezedrommond
Posts: 19
Joined: Wed Oct 23, 2019 11:41 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Argentina

Re: Relighting Doom v2.54b [Updated 2/5/22]

Post by ezedrommond »

I'm getting an error when loading this mod with the latest version of LitDoom. This error wasn't there in Relighting v.2.53b.



Load order:

Post Reply

Return to “Gameplay Mods”