Post process pixelation shader

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.
Locked
User avatar
Chl
Posts: 219
Joined: Sat Dec 05, 2015 2:18 pm

Post process pixelation shader

Post by Chl »

It says in the Wiki that shaders can only be applied to graphics, but since we now have bloom and stuffs I thought I ask anyway. Is it possible for me with limited knowledge to apply a post process pixalation shader?

I "assume" this is what I mean.

Code: Select all

out vec4 FinalColor;
in vec2 FragUV;
uniform sampler2D Texture;

void main()
{
        float Pixels = 512.0;
        float dx = 15.0 * (1.0 / Pixels);
        float dy = 10.0 * (1.0 / Pixels);
        vec2 Coord = vec2(dx * floor(FragUV.x / dx),
                          dy * floor(FragUV.y / dy));
        FinalColor = texture(Texture, Coord);
}
User avatar
Nash
 
 
Posts: 17501
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Post process pixelation shader

Post by Nash »

Sure you can, you'd have to add the required C++ in the engine to support it though. Stuff like that bloom, SSAO etc are heavily augmented with C++, they aren't just GLSL inside gzdoom.pk3 alone.
User avatar
Rachael
Posts: 13956
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Post process pixelation shader

Post by Rachael »

Window buffer scaling support is going to be supported in the engine officially LONG before any sort of pixel-doubling shader ever will.

It's rather inefficient to waste rendering 3 out of 4 of your pixels when you're only going to show 1 out of the 4 of them, anyway. It's better to just draw them at low res to start with and then stretch them onto the screen.

If you really want to do retro shaders for at least this much, you really ought to start there.
User avatar
Chl
Posts: 219
Joined: Sat Dec 05, 2015 2:18 pm

Re: Post process pixelation shader

Post by Chl »

Nash wrote:Sure you can, you'd have to add the required C++ in the engine to support it though. Stuff like that bloom, SSAO etc are heavily augmented with C++, they aren't just GLSL inside gzdoom.pk3 alone.
Probably out of reach for me then. But out of curiosity, what topics should I check out for this?
Rachael wrote:Window buffer scaling support is going to be supported in the engine officially LONG before any sort of pixel-doubling shader ever will.

It's rather inefficient to waste rendering 3 out of 4 of your pixels when you're only going to show 1 out of the 4 of them, anyway. It's better to just draw them at low res to start with and then stretch them onto the screen.

If you really want to do retro shaders for at least this much, you really ought to start there.
That sounds much better for that effect I would guess. But what I had in mind was to make a pixelation screen wipe and something that do not pixelate the hud.
User avatar
InsanityBringer
Posts: 3392
Joined: Thu Jul 05, 2007 4:53 pm
Location: opening the forbidden box

Re: Post process pixelation shader

Post by InsanityBringer »

Chl wrote:That sounds much better for that effect I would guess. But what I had in mind was to make a pixelation screen wipe and something that do not pixelate the hud.
This wouldn't have to apply to everything. I presume in this case the 3D view would be rendered to a low-resolution framebuffer and then drawn on screen scaled up. You can still draw the hud over that at the native resolution. I don't know how GZDoom's rendering pipeline works in detail though, so I can't comment on how it would actually get implemented.
User avatar
Caligari87
Admin
Posts: 6236
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: Post process pixelation shader

Post by Caligari87 »

Note that there actually exists code for that very purpose. Apparently it kind of works but was abandoned because it would probably break stuff for minimal benefit.

8-)
Locked

Return to “Editing (Archive)”