Reverse brightmaps (Darkmaps?)

Requests go in THIS forum!
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
User avatar
TDRR
Posts: 815
Joined: Sun Mar 11, 2018 4:15 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Debian 12/ Manjaro
Graphics Processor: nVidia with Vulkan support
Location: Venezuela

Reverse brightmaps (Darkmaps?)

Post by TDRR »

What i'm looking for is basically brightmaps that instead of making a pixel fullbright, make the surface darker depending on the input image's brightness on that pixel. I did this by editing func_brightmap.fp and replacing the + with a -, but even for my standards that's too hacky.

So i'm wondering if anyone with more knowledge could make a custom shader that did this. Thanks in advance for any help.

EDIT: Would also be nice if it was half resolution since i'm planning to use it with high-res textures, but it's not strictly necessary.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Reverse brightmaps (Darkmaps?)

Post by Graf Zahl »

Why is this 'too hacky'? That's precisely how I'd do it, too. To make the process more intuitive you might also try a negative scale, i.e. make white the neutral color and let darker colors affect the output.
Regarding resolution, that's automatic for texture layers, having a brightmap or any other layer will always map the layer texture to the full size of the base texture.
User avatar
TDRR
Posts: 815
Joined: Sun Mar 11, 2018 4:15 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Debian 12/ Manjaro
Graphics Processor: nVidia with Vulkan support
Location: Venezuela

Re: Reverse brightmaps (Darkmaps?)

Post by TDRR »

Graf Zahl wrote:Why is this 'too hacky'? That's precisely how I'd do it, too. To make the process more intuitive you might also try a negative scale, i.e. make white the neutral color and let darker colors affect the output.
Regarding resolution, that's automatic for texture layers, having a brightmap or any other layer will always map the layer texture to the full size of the base texture.
It's "too hacky" because it would require me to pretty much distribute a separate gzdoom.pk3 (Or can i override it in a separate file?) and even if i could do it externally, it would completely remove all normal brightmap functionality.

But, if you think it's fine, then i guess all i need is that you tell me a way to invert the original image's colors before processing it, since right now brighter in the image equals darker in game.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Reverse brightmaps (Darkmaps?)

Post by Graf Zahl »

I thought you considered the implementation hacky.
Unfotunately the engine has no concept of negative color values so I guess the hardware shader route is the only way to go here.
The needed shader won't look much different from what you already have. The brightmap isn't really much more than a predefined hardware shader that only affects the lighting, not the texture.
User avatar
TDRR
Posts: 815
Joined: Sun Mar 11, 2018 4:15 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Debian 12/ Manjaro
Graphics Processor: nVidia with Vulkan support
Location: Venezuela

Re: Reverse brightmaps (Darkmaps?)

Post by TDRR »

Graf Zahl wrote:I thought you considered the implementation hacky.
Unfotunately the engine has no concept of negative color values so I guess the hardware shader route is the only way to go here.
The needed shader won't look much different from what you already have. The brightmap isn't really much more than a predefined hardware shader that only affects the lighting, not the texture.
Okay, got it. I'm going to read up on all this fancy shader stuff and see if i can make one easily.
Post Reply

Return to “Requests”