(GZDoom) Monochrome global shader

For high-res texture/sprite projects, sprite-fix patches, music add-ons, music randomizers, and other graphic/sound-only projects.
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
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

(GZDoom) Monochrome global shader

Post by ZZYZX »

This is a PK3 that will make your Doom black and white.
So basically few days ago I saw Zeberpal's monochrome software pyramid WAD and wanted to reproduce that effect with GLSL.
I couldn't reproduce exactly that effect (for that, see InsanityBringer's post), but made something good enough to put it as a separate mod in a separate thread.
Note that for this to work, relatively recent version of GZDoom is required (tested on pre-r1729).

Screenshot: http://i.imgur.com/tCSLOJL.png
Download: http://www.mediafire.com/download/skjy2 ... chrome.pk3
Bonus screenshot (tied this shader to subtractive lights): http://i.imgur.com/361mFsV.png
Bonus download: http://www.mediafire.com/download/dukto ... ective.pk3

Code is free to use anywhere, whatever.
Also see my other shader tinkering here.

Known bugs: the weapon is not monochrome because of the way I'm detecting HUD (since the HUD shouldn't be monochrome).
Last edited by ZZYZX on Fri Aug 19, 2016 11:08 am, edited 4 times in total.
User avatar
ibm5155
Posts: 1268
Joined: Wed Jul 20, 2011 4:24 pm
Contact:

Re: (GZDoom) Monochrome global shader

Post by ibm5155 »

Hey, ZZYZX, since you're more into this glsl area, do you know if it's hard to make a proper flash light using the shaders? I already tried once and it almost worked well, the only problem were there missing values alike the gamera angle and pitch.
Do you belive it's hard to send those values into the glsl shaders? (plus some bool flag for enable/disable the flashlight :D )
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: (GZDoom) Monochrome global shader

Post by Nash »

Directional spotlights should be added into GZDoom as a stock feature IMO.
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

Re: (GZDoom) Monochrome global shader

Post by ZZYZX »

ibm5155 wrote:the only problem were there missing values alike the gamera angle and pitch.
I think angle and pitch is ViewMatrix in world coordinates. Not 100% sure though.

Code: Select all

void FGLRenderer::SetViewMatrix(fixed_t viewx, fixed_t viewy, fixed_t viewz, bool mirror, bool planemirror)
{
	float mult = mirror? -1:1;
	float planemult = planemirror? -glset.pixelstretch : glset.pixelstretch;

	gl_RenderState.mViewMatrix.loadIdentity();
	gl_RenderState.mViewMatrix.rotate(GLRenderer->mAngles.Roll,  0.0f, 0.0f, 1.0f);
	gl_RenderState.mViewMatrix.rotate(GLRenderer->mAngles.Pitch, 1.0f, 0.0f, 0.0f);
	gl_RenderState.mViewMatrix.rotate(GLRenderer->mAngles.Yaw,   0.0f, mult, 0.0f);
	gl_RenderState.mViewMatrix.translate(FIXED2FLOAT(viewx) * mult, -FIXED2FLOAT(viewz) * planemult , -FIXED2FLOAT(viewy));
	gl_RenderState.mViewMatrix.scale(-mult, planemult, 1);
}
But I don't think you even need that, for simple flashlight it's enough to work in screen space using gl_FragCoord or something like I made in my mod (because for whatever reason gl_FragCoord wasnt working for me... wat)
Turning shader effects on and off is not possible though. Maybe if you could check if camera has nonzero roll... but then again, this information is only stored in a matrix and I don't think there's a way to check if roll is 0 in an already computed matrix.

Also technically you can send a bool variable but you will need to modify GZDoom itself. Scene uniforms are stored and set in gl_RenderState.
User avatar
Zeberpal
Posts: 189
Joined: Sun Apr 28, 2013 2:06 am
Location: RU

Re: (GZDoom) Monochrome global shader

Post by Zeberpal »

ZZYZX,

Let's say I have an acid green color(#00FF00 aka 0,255,0), and I wish it to get chromokeyed with your shader effect. But just this concrete color shade. Exclude all the other shades of green palette. Everything that has this color - textures, sprites, models even is affected by shader. Is it possible in theory?
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

Re: (GZDoom) Monochrome global shader

Post by ZZYZX »

So basically things that have **FE** aren't affected, but **FF** are? Yes, this is perfectly possible and even better than with dynamic lights. Since dynamic lights won't work on actors and hence my "partial" shader version is bad and doesn't work on actors really.

Actually, I just realized that you can tie the shader to desaturation factor, and then actors are affected flawlessly, even though dynamic lights (for this effect) won't be supported.
I also fixed the shader so that it no more requires replacing main.vp and also supports recoloring of player's weapon.

http://www.mediafire.com/download/vb74x ... eDesat.pk3
User avatar
Zeberpal
Posts: 189
Joined: Sun Apr 28, 2013 2:06 am
Location: RU

Re: (GZDoom) Monochrome global shader

Post by Zeberpal »

wow, that's neat effect! It's green dynlights that desature the wall, am I right?
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

Re: (GZDoom) Monochrome global shader

Post by ZZYZX »

No. It's not dynlights at all. It's UDMF desaturation factor put on the sector.
User avatar
Zeberpal
Posts: 189
Joined: Sun Apr 28, 2013 2:06 am
Location: RU

Re: (GZDoom) Monochrome global shader

Post by Zeberpal »

ZZYZX, this is stunning %)
Post Reply

Return to “Graphic/Audio Patches”