WIP- Colour Map Shader

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

WIP- Colour Map Shader

Postby Pixel Eater » Thu Oct 12, 2017 12:49 am

I'm stuck on this project and hope someone can help me. I am using Old Video Shader as a template and replacing it's guts with a modified copy of the Palette shader code. The aim is to replace the brightness values from the Palette shader with the information from the true colour render.
I can get it to run but it's tinting everything based on the lower left corner. Even when I comment out my portion of the code it behaves similarly, only darker. It does seem to be slightly palette aware though.

This link downloads what I have so far but with my lines disabled, so it should behave the same as the built in Palette shader (it doesn't):
colourmap_shader_broken.pk3

gldefs.txt:
Spoiler:
shaders/PostProcess/ColourMap.fp:
Spoiler:
You do not have the required permissions to view the files attached to this post.
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: WIP- Colour Map Shader

Postby Rachael » Thu Oct 12, 2017 6:01 am

First and foremost, the palette table requires support code from the C++ side - I have no doubt it can be done shader side but it will require inputting the palette data in some way and then it's a lot of extra work to make it work.

Secondly, can you use some screenshots to explain what you mean? I am sorry but reading what you are trying to do is just very confusing.
User avatar
Rachael
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support

Re: WIP- Colour Map Shader

Postby Pixel Eater » Thu Oct 12, 2017 7:08 am

Sorry for the confusion! If you think about it as using the Color/Luminosity blend modes in Photoshop between the Palette shader and the dry output does that make more sense? In doing that it should only utilize the colour map part of the Palette shader's effect.
Notice the colour banding is removed from the last pane:
shader-demo.png
Won't the background C++ stuff already be in place for the current Palette shader? This is only a tweak on the output of that...
You do not have the required permissions to view the files attached to this post.
Last edited by Pixel Eater on Thu Oct 12, 2017 7:15 am, edited 1 time in total.
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: WIP- Colour Map Shader

Postby Rachael » Thu Oct 12, 2017 7:13 am

Okay, I see what you are doing now. You're applying True-Color's luminosity to Paletted's Saturation/Hue.

One of the bigger problems you have is the PaletteLUT table (is a texture) is not populated until the first time you type "gl_tonemap 5" - I suppose I could add in an argument for custom shaders to force it to be populated when the shader is activated.

What other problems are you having besides this?
User avatar
Rachael
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support

Re: WIP- Colour Map Shader

Postby Pixel Eater » Thu Oct 12, 2017 7:35 am

Okay, I see what you are doing now. You're applying True-Color's luminosity to Paletted's Saturation/Hue.

That's better than I could ever put it :)
One of the bigger problems you have is the PaletteLUT table (is a texture) is not populated until the first time you type "gl_tonemap 5" - I suppose I could add in an argument for custom shaders to force it to be populated when the shader is activated.

That sounds like it would be helpful. Does that override custom palettes?
What other problems are you having besides this?

This is what I get when I omit my blending code (for a basic Palette shader):


And this is when I include it:


The colour of the tint changes depending on what occupies the lower left corner of the screen.
Last edited by Pixel Eater on Mon Aug 13, 2018 4:21 pm, edited 1 time in total.
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: WIP- Colour Map Shader

Postby Rachael » Thu Oct 12, 2017 8:20 am

It's quite likely that PaletteLUT is not actually being passed to the shader - this will require further modification on the C++ side.
User avatar
Rachael
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support

Re: WIP- Colour Map Shader

Postby Pixel Eater » Thu Oct 12, 2017 5:02 pm

Thanks Rachael. I will submit a feature request then 8-)
*Dun!
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: WIP- Colour Map Shader

Postby Pixel Eater » Fri Oct 13, 2017 5:08 pm

I've had an idea: can I embed a custom image into the .pk3 file to use instead of PaletteLUT? I have an extended colour map which I designed and proposed in this feature request that I could reuse for this project. If I could, it would mean I would no longer be overlaying a 24bit image with an 8bit colour map :ninja:

Actually it would be cool if I could store different versions and be able to select them from the menu. Sounds like another feature request :P
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: WIP- Colour Map Shader

Postby Rachael » Fri Oct 13, 2017 9:51 pm

You can do it but keep in mind that PaletteLUT is made a certain way and is nowhere near the same format as a real COLORMAP.
User avatar
Rachael
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support

Re: WIP- Colour Map Shader

Postby Pixel Eater » Sat Oct 14, 2017 9:14 pm

I'm guessing PaletteLUT is generated on startup because I can't find it in gzdoom.pk3 or by searching this site. Is there a way to export it while Doom is running, maybe even by drawing it to screen and taking a screenshot? At that point, will embedding it into the .pk3 file's root directory cause the line "uniform sampler2D PaletteLUT;" to work correctly or is it more complicated than that?
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: WIP- Colour Map Shader

Postby Rachael » Sat Oct 14, 2017 9:46 pm

There is no way to export it - it is dynamically generated. It is also referenced by pointer, not by name, so you cannot access it anyhow.

It is possible, however, to create a program that's embedded into GZDoom's source code and create a PNG of it after it's generated. Graf could probably easily do it if he had the time and desire, I could do it with a great deal more difficulty but eventually I'd figure it out, but unfortunately I have a lot of projects as it is that I've been putting off that I really need to get to.
User avatar
Rachael
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support

Re: WIP- Colour Map Shader

Postby Pixel Eater » Sat Oct 14, 2017 10:20 pm

No worries and thank you for all your help, I appreciate it :mrgreen:

I might go for plan B and request an additional option to go alongside Palette Exponent and Order that blends the luminosity back in. I had hoped to play with perceptually weighting the luminance or matching the visibility of software Doom but I won't be able to experiment with those in that situation. Which is why I wanted to have it as a 'standalone' working prototype 8-)
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: WIP- Colour Map Shader

Postby Pixel Eater » Thu Nov 23, 2017 4:21 am

I've had an idea: can I embed a custom image into the .pk3 file to use instead of PaletteLUT?
You can do it but keep in mind that PaletteLUT is made a certain way and is nowhere near the same format as a real COLORMAP.
Could you please expand on how that is achieved? I have created a custom LUT file (hopefully in the right configuration :P ) and placed it in a .pk3 file, called it by typing "uniform sampler2D *filename*;" and then mapped it to the screen. All I get is a regular view of E1M1. Does the LUT file need to be in a certain directory?
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: WIP- Colour Map Shader

Postby dpJudas » Thu Nov 23, 2017 5:40 am

The filename is the name of a lump. I can't remember exactly which naming rules it uses - you might have to type the full path of the file within the .pk3 - i.e. with a slash in front or maybe place it in a subfolder so that there is a path component in the filename.
dpJudas
 
 
 
Joined: 28 May 2016

Re: WIP- Colour Map Shader

Postby Pixel Eater » Thu Nov 23, 2017 6:13 am

Hmm, I've just tried every permutation I can think of: "./graphics/", "/graphics/", using the .png file extension, enclosing it in quotation marks and all again within gldefs instead of the shader.

Here's the LUT I've made, does it look to be the correct format?:
Last edited by Pixel Eater on Mon Aug 13, 2018 4:22 pm, edited 1 time in total.
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Next

Return to Assets (and other stuff)

Who is online

Users browsing this forum: No registered users and 0 guests