AuthorTopic: Looking for someone who knows how to write a simple Unity shader  (Read 1912 times)

Offline daramon

  • 0001
  • *
  • Posts: 73
  • Karma: +0/-0
    • View Profile
In a random forum.unity.com comment about pixel perfect cameras, I saw the following piece of advice:

Quote
Don't use a pixel perfect camera. Instead write a shader that samples the texture for each pixel drawn on screen. If the sample is 100% one colour then draw that colour. If it is somewhere between 2+ colours then draw the average. So you will still get fairly crisp pixel art without blurring (unlike bilinear filtering which burs based on sampled image resolution, not screen resolution) but you will also get an antialiased effect that is only 1 screen pixel wide at most regardless of zoom level.

example: https://www.shadertoy.com/view/ltBGWc

If you follow the example, the results are quite impressive. This technique has the potential to allow pixel art games in Unity without black borders, shimmering or similar artifacts. The only downside is a maximum of 1px blur on the display screen's resolution. (Of course, you'd have to apply the same processes as usual to the individual sprites and elements to avoid blurring at the pixel-art resolution.)

It may just look awful in play of course. But I'd like to try. All that's needed is a very simple shader applied to the camera but unfortunately I don't know much about the shader system, and it looks like a bit of a rabbit hole to learn right now for such a simple tool.

Your reward is the tool itself. You can even put it on the asset store and see if you can get some $$$... ;)