summaryrefslogtreecommitdiffstats
path: root/Shaders/displacement/displacement.shader
blob: 5c0b51787982155506ad99f598ebcef63840d0e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Shader "yum_food/displacement"
{
  Properties
  {
    _BaseColor("Base color", 2D) = "white" {}
    _Normal("Normal", 2D) = "bump" {}
    _Disable_Normal_Texture("Disable normal texture", float) = 1.0
    _Metallic("Metallic", 2D) = "white" {}
    _Roughness("Roughness", 2D) = "black" {}
		_Cubemap("Cubemap", Cube) = "" {}

    _Height("Height", 2D) = "black" {}
    _Height_LOD("Height LOD", float) = 8.0
    _Height_Scale("Height scale", float) = 1.0
    _Height_Exponent("Height exponent", float) = 1.0
    _Height_Speed_X("Height speed (X axis)", float) = 0.0
    _Height_Speed_Y("Height speed (Y axis)", float) = 0.0
    _Height_AA_Sample_Scale("Height anti-alias UV scale", float) = 0.001

    _Height_Mask("Height mask", 2D) = "white" {}
    _Height_Mask_Exponent("Height mask exponent", float) = 1.0

    _Center_Out_Speed("Center out speed", float) = 0.0
    _Center_Out_Sharpness("Center out sharpness", float) = 4.0
    _Center_Out_Min_Radius("Center out min radius", float) = -1.0
    _Center_Out_Max_Radius("Center out max radius", float) = 2.7
  }
  SubShader
  {
    Pass {
      Tags {
        "RenderType"="Opaque"
        "Queue"="AlphaTest+499"
        "LightMode" = "ForwardBase"
      }
      Blend SrcAlpha OneMinusSrcAlpha
      ZWrite On
      ZTest LEqual
      Cull Back

      CGPROGRAM
      #pragma target 5.0

      #pragma multi_compile _ VERTEXLIGHT_ON

      #pragma vertex vert
      #pragma geometry geom
      #pragma fragment frag

      #define FORWARD_BASE_PASS

      // Three anti-aliasing levels.
      // 0: no anti-aliasing
      // 1: sample 4 neighbors (diagonals)
      // 2: sample 8 neighbors (diagonals + cartesian)
      #define HEIGHT_AA_LEVEL 2

      #include "displacement_lighting.cginc"
      ENDCG
    }
    Pass {
      Tags {
        "RenderType" = "Opaque"
        "LightMode" = "ForwardAdd"
        "Queue"="AlphaTest+499"
      }
      Blend One One
      ZWrite On
      ZTest LEqual
      Cull Back

      CGPROGRAM
      #pragma target 5.0

      #pragma multi_compile_fwdadd

      #pragma vertex vert
      #pragma geometry geom
      #pragma fragment frag

      #define HEIGHT_AA_LEVEL 2

      #include "displacement_lighting.cginc"
      ENDCG
    }
  }
}