<h1 style="font-size: 2.5em; font-weight: 800; text-align: center; margin-top: 0.5em; margin-bottom: 0.8em;"> Depth Based Pixelator </h1> ## * IMPORTANT This asset supports Unity 2022+ and Unity 6+. However, it is not compatible with MSAA in Unity 6+ and should be disabled when using that version. Note that MSAA offers no visual benefit when used with a pixelizer and will cause the edges to blend with the background color. ## ∗ Quick Start <h3 style="margin-bottom: 0.5em;">Renderer Feature</h3> 1. **Setup Renderer Feature** In your `Universal Renderer Data`, click `Add Renderer Feature`. Select `Pixelation Feature` from the dropdown. 2. **Assign the Material** In the newly added `Pixelation Feature`, assign the required `Pixelation material`. *(Path: Bepth-Based Pixelator\Materials\Pixelation.mat)* <h3 style="margin-bottom: 0.3em;">Cleaner Edge</h3> Please disable `Anti Aliasing (MSAA)` in your `Render Pipeline Asset` to prevent edges from blending colors with the background. **(MSAA must be disabled if you're using Unity 6 or higher.)** ![Render Pipeline Asset 2](https://hackmd.io/_uploads/HJUZxmDJWg.png) <h3 style="margin-bottom: 0.3em;">Material UI</h3> <img src="https://hackmd.io/_uploads/ry5cTfD1We.png" alt="Material UI" style="margin-bottom:4px;"> - **Depth Thresholds**: Distances from the camera that define depth layer boundaries. - **Resolutions**: The rendering resolution for each depth layer. Higher resolution gives smaller pixels and more detail. **Full Resolution Layer:** Setting the last layer’s resolution to be equal to or greater than your screen height will make it render at full resolution. Other layers remain capped to maintain performance, ensuring an optimal balance between visual clarity and efficiency. <br> ## Features Pixelize your 3D scene with **perspective camera support**. <h3 style="margin-bottom: 0.3em;">Shader Free</h3> Requires no special shaders so you can keep your existing materials. <h3 style="margin-bottom: 0.3em;">Depth Based Pixelation</h3> This effect applies pixelation that changes based on the depth of each pixel. Allowing you to have full control over in which depth range the resolution should be. <h3 style="margin-bottom: 0.3em;">Perspective Camera Support</h3> Unlike many pixelation shaders/cameras that work best with orthographic projection, this system is designed specifically for perspective cameras. It pixelates the screen based on depth, making it suitable for immersive 3D games. <h3 style="margin-bottom: 0.3em;">Native Resolution</h3> This asset supports a full-resolution depth layer, allowing you to render the final depth layer at your scene’s native resolution. <h3 style="margin-bottom: 0.3em;">Customizable Depth Mapping</h3> You have full control over how the scene is divided into resolution levels. Adjust depth thresholds to define where the pixelation changes, and specify how many levels you want. This makes the system flexible and easy to adapt to any kind of scene or scale. <h3 style="margin-bottom: 0.3em;">Per-Level Resolution Control</h3> Each depth level can have its own assigned pixel size. You can fine-tune how coarse or fine the pixelation is at each range. <h3 style="margin-bottom: 0.3em;">Resolution Multiply Factor</h3> This variable serves as a global multiplier, allowing you to control the overall scale more conveniently and achieve quick adjustments across all levels. <br> ## Other Notes <h3 style="margin-bottom: 0.3em;">Performance</h3> The performance impact of this effect can vary, depending largely on the total number of layers. For example, if you use 7 layers with one set to full resolution, you can expect the framerate to drop to around 3/4 of the original. <h3 style="margin-bottom: 0.3em;">Resolution</h3> The resolution variable represents the number of pixels in the screen’s height. For example, if `res = 10`, the screen height will consist of 10 pixels. <h3 style="margin-bottom: 0.3em;">Thin Objects</h3> Very thin geometry — such as wires, grass, or fence poles — may not pixelate cleanly and loss detail. <h3 style="margin-bottom: 0.3em;">Transparent Materials</h3> Avoid using transparent materials, as they don’t write to the depth buffer. As a result, the pixelation resolution will be determined by the depth of whatever is behind the transparent object. This isn’t usually an issue if the background has a similar pixelation level (e.g. shallow water), but it can produce unexpected results in scenes with large depth differences. <h3 style="margin-bottom: 0.3em;">Subpixel Limitation (Perspective Cameras)</h3> Subpixel stability — where pixelation “locks” perfectly to world space — is generally not possible with perspective cameras. This is because, in a perspective projection, objects at different depths move at different speeds relative to the camera (parallax). As a result, a single world-space-aligned pixel grid can't be consistently applied across the entire scene. While orthographic projections can maintain subpixel-perfect alignment (since all objects move uniformly), perspective projection inherently breaks that possibility. However, you can reduce the visual impact of this effect by: 1. Using a higher resolution (smaller pixels), which makes snapping less noticeable 2. Applying less gliding camera movement, which hides jitter more effectively than slow, precise movement. <h3 style="margin-bottom: 0.3em;">Know issues</h3> - Not all pixels are always 100% square. - The effect does not currently support **camera stacking**. - Effects may work correctly in the Unity Editor but fail to render in builts, showing an `Unexpected directive` error in the console. ![image 1 (3)](https://hackmd.io/_uploads/BkDFlcM4Ze.png) This issue can be caused by the Editor language setting. Setting both **Language for Non-Unicode Programs** and **Display Language** to English has been reported to resolve the problem in affected cases. ![image](https://hackmd.io/_uploads/Sy1F19GVZg.png) (see the Unity forum thread: https://discussions.unity.com/t/urp-fullscreen-shader-graph-unexpected-directive-error-and-not-rendering-in-build/1701257) <br> ## Supported Versions - Unity 2022+ - Unity 6+ <small>(Unity 6.0.58f2+)</small> --- Join our [Discord Server](https://discord.gg/9jVjbSnpcH) for further supports.