yum-archive/SoggyShaders

Old Unity shaders.

git clone https://git.yummers.dev/yum-archive/SoggyShaders

yumFix normal calculation in displacement shader6a14a2d

master
2.2 KiB88 linesraw
1Shader "yum_food/displacement"
2{
3  Properties
4  {
5    _BaseColor("Base color", 2D) = "white" {}
6    _Normal("Normal", 2D) = "bump" {}
7    _Disable_Normal_Texture("Disable normal texture", float) = 1.0
8    _Metallic("Metallic", 2D) = "white" {}
9    _Roughness("Roughness", 2D) = "black" {}
10		_Cubemap("Cubemap", Cube) = "" {}
11
12    _Height("Height", 2D) = "black" {}
13    _Height_LOD("Height LOD", float) = 8.0
14    _Height_Scale("Height scale", float) = 1.0
15    _Height_Exponent("Height exponent", float) = 1.0
16    _Height_Speed_X("Height speed (X axis)", float) = 0.0
17    _Height_Speed_Y("Height speed (Y axis)", float) = 0.0
18    _Height_AA_Sample_Scale("Height anti-alias UV scale", float) = 0.001
19
20    _Height_Mask("Height mask", 2D) = "white" {}
21    _Height_Mask_Exponent("Height mask exponent", float) = 1.0
22
23    _Center_Out_Speed("Center out speed", float) = 0.0
24    _Center_Out_Sharpness("Center out sharpness", float) = 4.0
25    _Center_Out_Min_Radius("Center out min radius", float) = -1.0
26    _Center_Out_Max_Radius("Center out max radius", float) = 2.7
27  }
28  SubShader
29  {
30    Pass {
31      Tags {
32        "RenderType"="Opaque"
33        "Queue"="AlphaTest+499"
34        "LightMode" = "ForwardBase"
35      }
36      Blend SrcAlpha OneMinusSrcAlpha
37      ZWrite On
38      ZTest LEqual
39      Cull Back
40
41      CGPROGRAM
42      #pragma target 5.0
43
44      #pragma multi_compile _ VERTEXLIGHT_ON
45
46      #pragma vertex vert
47      #pragma geometry geom
48      #pragma fragment frag
49
50      #define FORWARD_BASE_PASS
51
52      // Three anti-aliasing levels.
53      // 0: no anti-aliasing
54      // 1: sample 4 neighbors (diagonals)
55      // 2: sample 8 neighbors (diagonals + cartesian)
56      #define HEIGHT_AA_LEVEL 2
57
58      #include "displacement_lighting.cginc"
59      ENDCG
60    }
61    Pass {
62      Tags {
63        "RenderType" = "Opaque"
64        "LightMode" = "ForwardAdd"
65        "Queue"="AlphaTest+499"
66      }
67      Blend One One
68      ZWrite On
69      ZTest LEqual
70      Cull Back
71
72      CGPROGRAM
73      #pragma target 5.0
74
75      #pragma multi_compile_fwdadd
76
77      #pragma vertex vert
78      #pragma geometry geom
79      #pragma fragment frag
80
81      #define HEIGHT_AA_LEVEL 2
82
83      #include "displacement_lighting.cginc"
84      ENDCG
85    }
86  }
87}
88