June 2018
Intermediate to advanced
392 pages
8h 57m
English
This technique can actually be improved even further. We can add an extra texture (or use the alpha channel of the main one) to indicate the amount of extrusion. This allows for much better control over which parts are raised or lowered. The following code shows you how it is possible to achieve such an effect (the main difference from what we've done before is in bold):
Shader "CookbookShaders/Chapter06/Normal Extrusion Map" { Properties { _MainTex("Texture", 2D) = "white" {} _ExtrusionTex("Extrusion map", 2D) = "white" {} _ Amount("Extrusion Amount", Range(-0.0001, 0.0001)) = 0 } SubShader { Tags{ "RenderType" = "Opaque" } CGPROGRAM #pragma surface surf Standard vertex:vert struct Input { float2 uv_MainTex; }; float ...