Page 1 of 1

[4.2.x] Powerup.ColorMap no longer works

Posted: Mon Jan 13, 2020 11:59 am
by Major Cooke

Code: Select all

class InvS : PowerupGiver
{
	Default
	{
		+COUNTITEM
		+INVENTORY.AUTOACTIVATE
		+INVENTORY.ALWAYSPICKUP
		+INVENTORY.BIGPOWERUP
		Inventory.MaxAmount 0;
		Powerup.Type "PowerInvulnerable";
		Powerup.Colormap 0.0, 0.0, 0.0, 1.0, 1.0, 1.0;
		Inventory.PickupMessage "$GOTINVUL";
	}
	States
	{
	Spawn:
		PINV ABCD 6 Bright;
		Loop;
	}
}
"Give InvS" in console. You'll see no colormap is applied. This is most likely related to the InverseMap changes that were made.

Re: [4.2.x] Powerup.ColorMap no longer works

Posted: Tue Jan 14, 2020 3:34 am
by _mental_
Works fine using OpenGL and Vulkan.
Screenshot_Doom_20200114_110531.jpg
It works incorrectly with SoftPoly though.
colormap_softpoly.jpg

Re: [4.2.x] Powerup.ColorMap no longer works

Posted: Tue Jan 14, 2020 3:57 am
by Rachael
This is probably a NYI thing in SoftPoly. Keep in mind the shader functions in SoftPoly are extremely time-sensitive - every new check or function you put in here will likely result in a FPS hit even when they are not active.

I think I could code in a colormap shader pretty easily, but I don't trust myself to be able to optimize it well, because I tend to favor code organization and moddability over speed. This probably needs dpJudas's SSE2 methods.

Re: [4.2.x] Powerup.ColorMap no longer works

Posted: Tue Jan 14, 2020 4:13 am
by Graf Zahl
I'm not sure if SSE2 is capable on operating on a byte target. The best course of action might be to create an 18 bit lookup table and then let 3 or 4 threads run over the image, translating each pixel. Doing such a uniform transformation ad-hoc per pixel may just be too slow.

Re: [4.2.x] Powerup.ColorMap no longer works

Posted: Tue Jan 14, 2020 8:50 am
by Major Cooke
For the record, I took that picture while in OpenGL mode. But not when using Vulkan.

Re: [4.2.x] Powerup.ColorMap no longer works

Posted: Tue Jan 14, 2020 9:03 am
by Rachael
Okay, from my test, it appears that this problem only occurs if you turn the custom invulnerability colormap on. If you have it off from the very moment you start GZDoom, it does not appear to occur.

Re: [4.2.x] Powerup.ColorMap no longer works

Posted: Fri Jan 17, 2020 5:41 am
by Grizzly
Rachael wrote:Okay, from my test, it appears that this problem only occurs if you turn the custom invulnerability colormap on. If you have it off from the very moment you start GZDoom, it does not appear to occur.
I can not confirm this. For me, running on softpoly, the Colormap simply doesn't work. This is on an installation that has never even touched the custom setting.

Re: [4.2.x] Powerup.ColorMap no longer works

Posted: Fri Jan 17, 2020 5:42 am
by Rachael
That's because it's not been done at all on SoftPoly. I was referring to OpenGL/Vulkan, there's more than one issue here.

Re: [4.2.x] Powerup.ColorMap no longer works

Posted: Sat Jan 18, 2020 5:42 am
by Rachael
Looks like dpJudas snuck this in so now all that remains is for me trying to fix the custom colormaps, themselves... if I can find the code that activates them.

Re: [4.2.x] Powerup.ColorMap no longer works

Posted: Sat Jan 18, 2020 7:04 am
by _mental_
The problem is in loosing all colormaps (except five hardcoded) added with AddSpecialColormap(). At least, R_InitColormaps() cannot be used to apply custom invulnerability colors.

Re: [4.2.x] Powerup.ColorMap no longer works

Posted: Sat Jan 18, 2020 7:17 am
by dpJudas
The code I added just tries to what the hardware renderer does already.

That said, I don't understand why the colormap shader reduces it to a blend when it could have uploaded the special colormaps as textures and applied them as a LUT. Is it just how the code evolved historically or there a deeper reason?

Re: [4.2.x] Powerup.ColorMap no longer works

Posted: Sat Jan 18, 2020 9:47 am
by _mental_
I reworked applying of customized invulnerability colormap in this PR. Testers and reviewers are welcome.

Re: [4.2.x] Powerup.ColorMap no longer works

Posted: Sat Jan 18, 2020 9:53 am
by Rachael
Looks good to me. I was probably going to do something similar to that but I hadn't gotten around to it.