Pixelated Effect in Unity Shader Graph

If you are looking for any info about how to make a pixelated effect on any sprite in Unity, look no further. I’ll show you how you can do that using Unity Shader Graph.

To use Shader Graph in Unity, you have to have a project which uses Universal or High Definition Render Pipeline. If you do, then let’s get to work!

Create a graph ?

At the start, we should create a new shader graph. You can do this by right-clicking in the Project Window and then Create > Shader > Unlit Shader

Create a new shader graph.

Next, we should open a newly created graph and start playing!

To create a pixelated effect, we will use a UV node inside the editor. UV values are between 0 and 1, so to create the effect, we need to play a bit with math!

The easiest way to create such an effect is to multiply the value of UV but the number bigger and 1, then floor the values and divide it back by the same value.

This is how it can look like.

Simple pixelate effect.

Create shader parameters ?‍?

We know how we want to create our effect, and now it’s time to add some additional parameters with which we can play.

Let’s start by creating texture and vector1.

Create a texture.
Create a vector1.

I would recommend naming them “_MainTex” and “Pixelate” like I did.

Shader parameters.

Now, we should combine parameters and the effect together to make this shader work!

Working pixelate shader effect.

This is one way to make it, but there is another one.

Normalized parameters ?

It’s a good practice to normalize some parameters. So we won’t put some stupid values and break a game with them.

In our case, it would be cool to normalize the “Pixelate” parameter in our shader.

Let’s start by adding one more parameter “Max Pixelization” which will be another vector1.

Normalized parameters.

Notice that I’ve changed “Pixelate” to be a slider!

Now, we can apply a new parameter in the graph. It will replace the current “Pixelate” param.

Graph with normalized parameters.

Result ?

Time to see the final result!

Changing Pixelate amount in shader.

What do you think about it? Let me know in the comment section below! ?

If you know someone that might need this, share it with him! I would really appreciate that! ?

And if you are interested in getting emails when I release a new post, sign up for the newsletter!

The whole project is available at my public repository. ?

Hope to see you next time! ?

4.8 10 votes
Article Rating
Subscribe
Notify of
guest
6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Chris H
Chris H
4 years ago

Cool! Nice Mode 7 effect. Or at least Super Mario World fade in / out effect 🙂
 

Last edited 4 years ago by Chris H
Neurisko
Neurisko
4 years ago

Images are too small to read.

trackback
3 years ago

[…] Pixelated Effect in Unity Shader Graph | Patryk Galach […]

Noob
Noob
2 years ago

Where do I put the shader after creation?

Michal Z
Michal Z
2 years ago

Is there a way to use it full-screen for 3D scenes?

ANTARA
ANTARA
1 year ago

Hi , i´ve seen this kinda shaders , they look cool but do you know how to do shaders like in this : https://www.youtube.com/watch?v=_0PpBepvjFk

6
0
Would love your thoughts, please comment.x
()
x