Custom Postprocessing Shaders - in devbuilds now
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.
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.
-
- Posts: 13718
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: [QZDoom] Custom Postprocessing Shaders - in devbuilds no
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
Also, it's not necessary to sticky every topic so you don't lose track of it. http://imgur.com/a/XVZpG
-
- 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
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?
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?
-
- Posts: 13718
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: Custom Postprocessing Shaders - in devbuilds now
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.
The zooming effect, however, is possible now, yes.
-
- 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
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.
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.
-
- Posts: 13718
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: Custom Postprocessing Shaders - in devbuilds now
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.
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.
-
- 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
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.
-
- Posts: 13718
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: Custom Postprocessing Shaders - in devbuilds now
No. Shaders cannot retrieve pre-shader data except from their own context.
-
- 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
I thought you were talking about shaders like dpJudas' scene tinting for the player.
-
- Posts: 13718
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: Custom Postprocessing Shaders - in devbuilds now
I have no idea what you mean.
-
-
- Posts: 3109
- Joined: Sat May 28, 2016 1:01 pm
Re: Custom Postprocessing Shaders - in devbuilds now
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.
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.
-
-
- Posts: 17454
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: Custom Postprocessing Shaders - in devbuilds now
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!
Also it seems the parser is too forgiving, I deliberately typed niform instead of Uniform and it happily accepted it with no error messages!
-
- Posts: 13718
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: Custom Postprocessing Shaders - in devbuilds now
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.
-
-
- Posts: 17454
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: Custom Postprocessing Shaders - in devbuilds now
Rachael: What happened to CustomTexture? Was it removed when this got into GZDoom?
/////////////////////////////
https://www.shadertoy.com/view/XlXXR4
https://www.shadertoy.com/view/llj3Dz
/////////////////////////////
These two shaders look pretty close to that special effect: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?
https://www.shadertoy.com/view/XlXXR4
https://www.shadertoy.com/view/llj3Dz
-
- Posts: 13718
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: Custom Postprocessing Shaders - in devbuilds now
It was removed QZDoom side before the 2.0 release.Nash wrote:Rachael: What happened to CustomTexture? Was it removed when this got into GZDoom?
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.
-
- Posts: 13718
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: Custom Postprocessing Shaders - in devbuilds now
I'd really like to unpin this topic. @Major Cooke - do you still need this stickied?