Custom Postprocessing Shaders - in devbuilds now

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Rachael
Posts: 13718
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: [QZDoom] Custom Postprocessing Shaders - in devbuilds no

Post by Rachael »

GZDoom has it now.

Also, it's not necessary to sticky every topic so you don't lose track of it. http://imgur.com/a/XVZpG
User avatar
Major Cooke
Posts: 8193
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Custom Postprocessing Shaders - in devbuilds now

Post by Major Cooke »

Fair enough.

Anyway, one question I have, and I get the feeling right now there isn't a way to do this still, but I'll ask it regardless.

Is there a way to discriminate between the level and actors? I wish to replicate Painkiller's fully immersed Demon Morph capabilities.



Everything becomes gray scale while monsters become reddish orange (and allies in Painkiller: Hell and Damnation turn blue). While I've gotten the global translations working, setting a sector's desaturation also desaturates the actors within it, bright or not. So that idea's out the window.

I take it right now I cannot just use a shader to black-and-white an entire level and exclude actors at the same time?

One more question, can that zooming warp effect (whenever firing, the zoom warbles at the center of the screen) be done now that we have these shaders?
User avatar
Rachael
Posts: 13718
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Custom Postprocessing Shaders - in devbuilds now

Post by Rachael »

A post process shader can only see the data on the screen as-is, and cannot differentiate between an actor and a wall. It literally only sees what you can see before it is applied.

The zooming effect, however, is possible now, yes.
User avatar
Major Cooke
Posts: 8193
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Custom Postprocessing Shaders - in devbuilds now

Post by Major Cooke »

Well, that's something at least.

I suppose this guide can give me the details I need for making the shader... I just don't know what land mines to watch out for (i.e. what different types of variables are available to us and what aren't), so input on that would be appreciated.
User avatar
Rachael
Posts: 13718
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Custom Postprocessing Shaders - in devbuilds now

Post by Rachael »

Right now, all uniforms (variable sets) except textures are available to the post-processing shaders. In your case you're very clearly going to need some way to convince your fragment shaders to pass data to the post processing shaders, and unfortunately that currently is not available (but *might* become so later on after Vulkan support is added).

In the mean time - you can have a look at this. Unfortunately, there's no way to deactivate the fragment shaders, so this is not suitable for use as a powerup, but it's a start.
User avatar
Major Cooke
Posts: 8193
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Custom Postprocessing Shaders - in devbuilds now

Post by Major Cooke »

Isn't there a 'normal' shader I can apply on top of it to get rid of it instead? Right now all I'm trying to focus on is the zooming capabilities, the rest I'll just have to hack in somehow using sector colors if necessary.
User avatar
Rachael
Posts: 13718
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Custom Postprocessing Shaders - in devbuilds now

Post by Rachael »

No. Shaders cannot retrieve pre-shader data except from their own context.
User avatar
Major Cooke
Posts: 8193
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Custom Postprocessing Shaders - in devbuilds now

Post by Major Cooke »

I thought you were talking about shaders like dpJudas' scene tinting for the player.
User avatar
Rachael
Posts: 13718
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Custom Postprocessing Shaders - in devbuilds now

Post by Rachael »

I have no idea what you mean.
dpJudas
 
 
Posts: 3109
Joined: Sat May 28, 2016 1:01 pm

Re: Custom Postprocessing Shaders - in devbuilds now

Post by dpJudas »

The uniforms available for the shader are the ones you declare yourself.

For example, if you want to make that "bubble" zoom effect (or whatever it is in that video) then you probably want to pass in a center location for the bubble (a vec2) and a size (a float). You do that by specifying your own "uniform vec2 ZoomCenter" and "uniform float ZoomSize" variables in the GLDEFS file. After doing that they exist as variables in the shader file. You can then set their values from ZScript using the Shader.SetUniform2f and Shader.SetUniform1f functions.
User avatar
Nash
 
 
Posts: 17454
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: Custom Postprocessing Shaders - in devbuilds now

Post by Nash »

So I was banging my head against the desk out of frustration last night over why my damn shaders wouldn't work... it seems the "scene" keyword is case sensitive (I had it as "Scene")... the parser seems to be silent and didn't complain about it. :P

Also it seems the parser is too forgiving, I deliberately typed niform instead of Uniform and it happily accepted it with no error messages!
User avatar
Rachael
Posts: 13718
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Custom Postprocessing Shaders - in devbuilds now

Post by Rachael »

These should be reported as bugs instead of posted here. Nevertheless I'll take a look and see what I can do to strictify the parser a little bit.
User avatar
Nash
 
 
Posts: 17454
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: Custom Postprocessing Shaders - in devbuilds now

Post by Nash »

Rachael: What happened to CustomTexture? Was it removed when this got into GZDoom?


/////////////////////////////
Major Cooke wrote: One more question, can that zooming warp effect (whenever firing, the zoom warbles at the center of the screen) be done now that we have these shaders?
These two shaders look pretty close to that special effect:

https://www.shadertoy.com/view/XlXXR4
https://www.shadertoy.com/view/llj3Dz
User avatar
Rachael
Posts: 13718
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Custom Postprocessing Shaders - in devbuilds now

Post by Rachael »

Nash wrote:Rachael: What happened to CustomTexture? Was it removed when this got into GZDoom?
It was removed QZDoom side before the 2.0 release.

The plan was to add it back at some point, but I gather dpJudas is having a bit of an issue with getting that to actually work right now.
User avatar
Rachael
Posts: 13718
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Custom Postprocessing Shaders - in devbuilds now

Post by Rachael »

I'd really like to unpin this topic. @Major Cooke - do you still need this stickied?

Return to “Editing (Archive)”