Home Creators Posts Import Register Favorites Logout
haven't archived this post yet. have a subscription? use the importer!

Content

http://www.alanzucconi.com/2016/05/04/lcd-shader/

When it comes to shader, is certainly true that the devil is in the detail. This is the case for 

Slime Rancher

, a game which features one of the best LCD display effects I've seen in a long time (image below). This tutorial will teach you how to replicate most of its charm in Unity.



Thank you for your time and your generous support!  ♥

Files

Previews only

Comments

Hakanai

The hard part here is that the LCD screen isn't the actual thing being grabbed... I was able to get GrabPass on a glass-like pane to work for distortions in world space, and for mosaicing the things behind it in world space, but distortions which require mapping to/from object space seem to be a different problem entirely. I figured out that I have to apply the pixelation to the UVs of the LCD panel itself, but I can't get from having the rounded UV values to having the equivalent coordinate from the GrabPass.

Hakanai

My eventual solution: float2 uv_panel = (floor(i.uv_panel * _Pixels) + 0.5) / _Pixels; float4 object_coords = float4(0, 0, 0, 1); object_coords.xy = uv_panel - 0.5; float4 clip_coords = UnityObjectToClipPos(object_coords); float4 uv_grab = ComputeGrabScreenPos(clip_coords); float4 pixel_rgb = tex2Dproj(_GrabTexture, UNITY_PROJ_COORD(uv_grab));

Petr Koza

Hi! How can I make it working with GrabPass instead of MainTex? I'm trying it 5 hours but unsuccessful...