(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 YOUR 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.

(GZDoom) Monochrome global shader

Postby ZZYZX » Thu Aug 18, 2016 4:00 pm

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 12:08 pm, edited 4 times in total.
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: (GZDoom) Monochrome global shader

Postby ibm5155 » Thu Aug 18, 2016 8:38 pm

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
ibm5155
Just Spooky
 
Joined: 20 Jul 2011

Re: (GZDoom) Monochrome global shader

Postby Nash » Thu Aug 18, 2016 10:14 pm

Directional spotlights should be added into GZDoom as a stock feature IMO.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: (GZDoom) Monochrome global shader

Postby ZZYZX » Fri Aug 19, 2016 3:40 am

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 allExpand view
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
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: (GZDoom) Monochrome global shader

Postby Zeberpal » Sat Aug 20, 2016 3:04 pm

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
Zeberpal
 
Joined: 28 Apr 2013
Location: RU

Re: (GZDoom) Monochrome global shader

Postby ZZYZX » Sat Aug 20, 2016 3:32 pm

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
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: (GZDoom) Monochrome global shader

Postby Zeberpal » Sat Aug 20, 2016 4:24 pm

wow, that's neat effect! It's green dynlights that desature the wall, am I right?
User avatar
Zeberpal
 
Joined: 28 Apr 2013
Location: RU

Re: (GZDoom) Monochrome global shader

Postby ZZYZX » Sat Aug 20, 2016 4:24 pm

No. It's not dynlights at all. It's UDMF desaturation factor put on the sector.
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: (GZDoom) Monochrome global shader

Postby Zeberpal » Sat Aug 20, 2016 4:41 pm

ZZYZX, this is stunning %)
User avatar
Zeberpal
 
Joined: 28 Apr 2013
Location: RU


Return to Graphic/Audio Patches

Who is online

Users browsing this forum: No registered users and 4 guests