Last active
January 7, 2021 22:49
-
-
Save cjacobwade/1d2160b8d137201963f1605cb34b4541 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This one is tied up with JMO toon shading, so I can't just past the shader :/ | |
half _SmushMinZ; | |
half _SmushXYOffset; | |
half4 _SmushCenterPos; | |
half4 initWorldPos; | |
// Vert | |
o.initWorldPos = worldPos; | |
half dist = _SmushMinZ - o.initWorldPos.z; | |
if(worldPos.z < _SmushMinZ) | |
{ | |
worldPos.z = _SmushMinZ - dist * 0.01; | |
worldPos.xy += dist * (worldPos.xy - _SmushCenterPos.xy) * _SmushXYOffset; | |
} | |
v.vertex = mul(unity_WorldToObject, worldPos); | |
// Surf/Frag | |
half wallDist = _SmushMinZ - IN.initWorldPos.z; | |
half smush = inverselerp(0, 0.1, saturate(wallDist)); | |
o.Albedo += lerp(0, o.Albedo * saturate(smush * 0.5), saturate(smush)); | |
o.Normal = lerp(o.Normal, half3(0, 0, 1), saturate(smush)); | |
o.Emission = saturate(lerp(o.Emission, 0, saturate(smush))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment