I just tried to add the Build lighting equation to GZDoom's shader to prepare the transition. Here's something interesting:
After setting up the basics, the Doom software lighting shader runs through several function levels, which make up between 20 and 30 lines of code depending on which lighting equation - vanilla or ZDoom - gets used.
From the same point onward in the code, the Build lighting equation has 5(!) lines of code. No wonder that the lighting looks so poor - the distance math is that much more primitive. Adding support for this was just a single 7 line 'if' block to the shader - I was somehow expecting more work...
Interesting tidbit about Build lighting
Re: Interesting tidbit about Build lighting
Does that mean we'll be able to use Build lighting in Doom and Doom lighting in Build?
- mjr4077au
- Posts: 834
- Joined: Sun Jun 16, 2019 9:17 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Gosford NSW, Australia
- Contact:
Re: Interesting tidbit about Build lighting
Finally, something that didn't take re-inventing the wheel to fixGraf Zahl wrote:I just tried to add the Build lighting equation to GZDoom's shader to prepare the transition. Here's something interesting:
After setting up the basics, the Doom software lighting shader runs through several function levels, which make up between 20 and 30 lines of code depending on which lighting equation - vanilla or ZDoom - gets used.
From the same point onward in the code, the Build lighting equation has 5(!) lines of code. No wonder that the lighting looks so poor - the distance math is that much more primitive. Adding support for this was just a single 7 line 'if' block to the shader - I was somehow expecting more work...
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Interesting tidbit about Build lighting
Gez wrote:Does that mean we'll be able to use Build lighting in Doom and Doom lighting in Build?
To make the Build lighting work in the shader I'll have to get it working in GZDoom first, before switching Raze over to the backend's render state. I cannot test such things on a non-functional setup that has no working backing implementation for it.
There's one thing, though: Doom lacks the 'visibility' property of the Build engine so while I can get the light mode to work it will be a bit incomplete and not really that useful.
When all is said and done, all light modes should work in Raze as well, but I doubt that they'll all be useful due to how the lighting was set up in the levels.
- sinisterseed
- Posts: 1349
- Joined: Tue Nov 05, 2019 6:48 am
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: Interesting tidbit about Build lighting
Somehow this actually, I figured this would be yet another one of those instances where it's gonna take yet another deep rewrite to get the feature working, but apparently not. Would be sick if getting the sky dome working won't be another insurmountable task either.mjr4077au wrote:Finally, something that didn't take re-inventing the wheel to fixGraf Zahl wrote:I just tried to add the Build lighting equation to GZDoom's shader to prepare the transition. Here's something interesting:
After setting up the basics, the Doom software lighting shader runs through several function levels, which make up between 20 and 30 lines of code depending on which lighting equation - vanilla or ZDoom - gets used.
From the same point onward in the code, the Build lighting equation has 5(!) lines of code. No wonder that the lighting looks so poor - the distance math is that much more primitive. Adding support for this was just a single 7 line 'if' block to the shader - I was somehow expecting more work...
I wonder how many sector lights will be useful in Build from Doom out of the box. I'm hoping for Software and Doom personally. Vanilla will probably be too dark, Standard too flat, and the rest... does anyone even use the rest?
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Interesting tidbit about Build lighting
You'll probably have to settle for "Bright". The basic lighting model is very different and using Doom's light modes unaltered will most likely make things too dark. Unlike Doom, Build doesn't have this steep falloff of the light level where 100 is almost zero visibility, so it is very likely I'll have to tweak the other modes a bit to make them work. We'll see.