Unlucky Seven - Update #3 - Unity pixelart workflow

Unlucky Seven

Unlucky Seven will take you on a space walk and tell you a story about love, hate, and craving for human flesh.

Today Blaze (our programmer) will let you know how to make your pixelart models and textures look great in Unity game engine. [quote=Blaze] When you create a 3d pixelart game in Unity (or any other game engine) you will encounter first problems as soon as you place your model with pixelart texture in the scene. [img]http://cdn.edgecast.steamstatic.com/steamcommunity/public/images/clans/27593463/170d13ce6329883b79c469d34d17c028746d6ce3.png[/img] [i]Default settings - filtering and mipmaps are on. There is a nasty blur on our pixelart texture, yuck![/i] The first thing you want to do is to turn off the mipmaps for all of your textures. This will prevent the engine from blurring your pixelart when the camera gets far away from the object. However, this is not enough to keep your art nice and crispy. It still gets blurred because of texture filtering (bilinear/trilinear/anisotropic). The easiest solution is to simply disable this effect by switching to point / nearest neighbor filtering. In many cases this is sufficient, but it does have a serious downside - there is a lot of visible and annoying jitter when you scale, rotate and view the textures at very shallow angles. It comes as no surprise as we just disabled everything which enhanced texture quality in such scenarios. [img]http://cdn.edgecast.steamstatic.com/steamcommunity/public/images/clans/27593463/3db1d3d1630f8759798c5b5638507aad8aaf6de8.png[/img] [i]Simple solution - no filtering and no mipmaps. Observe the jitter that appears at distance. In most cases this is acceptable but we decided to go one step further...[/i] So what else can we do to achieve smooth pixel edges without blurring the textures? The solution is to use custom shaders. With some patience and shader-writting skills you can either create your own from ground up or modify an existing solution. We based our shaders on the simple and efficient RetroAA package from unity asset store ([url=https://www.assetstore.unity3d.com/en/#!/content/65509]you can find it here[/url]) - it's a great starting point for any pixelart shader needs. [img]http://cdn.edgecast.steamstatic.com/steamcommunity/public/images/clans/27593463/fc9ebb2c9109026e2dbae1b2160612a109cd98a3.png[/img] [i]Best solution - custom shader. Crisp pixelart and no jitter.[/i] Okay, so you have your 3d objects in the scene and the textures display properly. As you continue building your level you might be worried about the difference of pixel scale between objects (for example: placing two instances of a rock next to each other and scaling one up to be two times bigger). You don't have to worry about such cases too much as different scales look perfectly fine next to each other as long as you stick to the rule that the bigger the object is the bigger pixel scale it can have as it places extra emphasis on it's huge size. [img]http://cdn.edgecast.steamstatic.com/steamcommunity/public/images/clans/27593463/bfdafbc2a1853b1f5a1d77acc1f84fc27eb8b65e.png[/img] [i]Bigger pixels on bigger objects are OK.[/i] Finally, you're adding some lights to the scene expecting the smooth shading to completely ruin the pixelart effect. Surprisingly, both smooth lighting and shadows look perfectly fine. However, it still helps to lower the dynamic shadow resolution as the pixelated/jagged shadow edges work great with pixelart textures while being more efficient to draw than high-res ones. [img]http://cdn.edgecast.steamstatic.com/steamcommunity/public/images/clans/27593463/dd7e1fcd0501a6c73bbd9c8e8b73ddfb713cf878.png[/img] [i]Look at the floor and observe how low-res shadows and smooth gradients created by the lights look absolutely fine. It's ok to use them as they don't interfere with the pixelart at all.[/i] [/quote] Tune in next time for an article from our screenwriter! [quote=Reminder] Add [i][url=http://store.steampowered.com/app/579120]Unlucky Seven[/url][/i] to your wishlist! It shows us your support and helps us out quite a bit! Be sure to follow us on [url=https://twitter.com/PuzzlingDream]Twitter[/url] and [url=https://www.facebook.com/puzzlingdream/]Facebook[/url] for the latest news![/quote]