summaryrefslogtreecommitdiffstats
path: root/Shaders/avatar_clone/avatar_clone.shader
blob: 768a3c2c6ca4c9d1bedd439d1c1bf2fe5a039c95 (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
89
90
91
92
93
94
95
96
97
98
99
100
101
Shader "yum_food/avatar_clone"
{
  Properties
  {
    _BaseColor("Base color", 2D) = "white" {}
    _Emission("Emission", 2D) = "black" {}
    _Emission_Strength("Emission strength", float) = 0.0
    _Normal("Normal", 2D) = "bump" {}
    [ToggleUI] _Disable_Normal_Texture("Disable normal texture", float) = 1
    [ToggleUI] _Disable_Normal_Recalc("Disable normal recalculation", float) = 1
    _Metallic("Metallic", 2D) = "black" {}
    _Roughness("Roughness", 2D) = "black" {}
		_Cubemap("Cubemap", Cube) = "" {}

    _Height("Height", 2D) = "black" {}
    [IntRange] _Height_LOD("Height LOD", Range(0, 8)) = 8
    _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

    [IntRange] _Num_Clones("Number of clones", Range(0, 4)) = 0
    _Clone_dx("Clone dx", float) = 1.0
    _Clone_dx_cents("Clone dx (cents)", float) = 0.0
    _Clone_dy("Clone dy", float) = 0.0
    _Clone_dz("Clone dz", float) = 0.0
    _Clone_Scale("Clone scale", float) = 1.0
    [ToggleUI] _Clone_Enable_Av_Height_Fix("Clone avatar height fix", float) = 0.0
    _Clone_Av_Height_Fix("Clone avatar height fix", float) = 0.0
    [ToggleUI] _Clone_Enable_Rotation("Enable clone rotation", float) = 0.0
  }
  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 "avatar_clone_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 "avatar_clone_lighting.cginc"
      ENDCG
    }
  }
}