UE4 - Pixel Shader - low-resolution panning and subtraction

Hey Real Time! I’ve been working on a pixel / dot style water shader, but ran into a bit of a problem. Essentially, the shader is set-up to create a eroding caustic effect through panning textures, but when the textures interact they smoothly pan over each other, causing the resultant caustic texture to not have discrete “pixelated” (1x1) edges.

causticPixel

Is there some form of texture compression or panning option that would make the pixels “step” discretely to get a proper pixelated erosion? The textures being used have been converted to paper 2D to alias properly at low resolutions, and are the same resolution.

Sorry if the explanation is a bit confusing, I’m having trouble describing the issue specifically!

5 Likes

This could be very useful!

You could create hi-res textures and then pixelate them using this awesome trick.

Is this what you were looking for? :sparkles:

1 Like

Instead of subtracting, use min, or at least make sure you always get binary results. It helps with the look in this case.

2 Likes

Thanks so much for the replies guys!

@Lush That link was exactly what I was looking for! I would never have thought to ceil time to get discrete stepping, it makes so much sense. There’s a bit of artifacting happening when I “re-pixelate” my already low-res textures, but I think that can be fixed by just re-exporting them to be higher res first before pixelating them in the shader.

causticLoop

@Niels Thanks for the advice! Right now the resultant masks are clamped into discrete ranges using a ceil so we can get a bit of range with the colours, but we’re workshopping the look of water as whole right now and might try going for complete binary in the future!

2 Likes

Hi!

I was working on similar like this too. It’s always efficient to pix-elate a high quality textures procedurally in engine (Which was already mentioned here haha).

https://imgur.com/a/q37t79q

4 Likes

Here’s what my setup looks like.
Pixelate material function.

Too achieve a seamless noises and by breaking the patterns. I use what they called 4 way chaos.


4 Way Chaos Material Function

By using 4 way chaos alone, you’ll still encounter visible patterns. For that, you’ll be needing to add more variations noises.

2 Likes

That looks great, love the highlights!

1 Like

Would love to see this style in an ocean shader with caustics.