yum/3ner

A toon shader for Unity's BIRP.

git clone https://git.yummers.dev/yum/3ner

yumAdd uv channel to glitter2e499c5

master
2.1 KiB122 linesraw
1#ifndef __DATA_INC
2#define __DATA_INC
3
4#include "glitter.cginc"
5#include "globals.cginc"
6
7// From filament: min roughness s.t. MIN_PERCEPTUAL_ROUGHNESS^4 > 0 in target
8// precision. Although we use fp32, the higher min roughness gives us a broader
9// specular highlight, which is preferable.
10#define MIN_PERCEPTUAL_ROUGHNESS 0.045
11#define MIN_ROUGHNESS            0.002025
12
13struct Pbr {
14  float4 albedo;
15  float3 geometric_normal;
16  float3 normal;
17  float3x3 tbn;
18  float smoothness;
19  float roughness_perceptual;
20  float roughness;
21  float metallic;
22#if (defined(_EMISSIONS) || defined(_LETTER_GRID)) && defined(FORWARD_BASE_PASS)
23  float3 emission;
24#endif
25#if defined(_BENT_NORMALS)
26  float3 bent_normal;
27#endif
28#if defined(_CLEARCOAT)
29  float3 cc_normal;
30  float cc_roughness;
31  float cc_roughness_perceptual;
32  float cc_strength;
33#endif
34#if defined(_PARALLAX_HEIGHTMAP) || defined(_BURLEY_TILING_HEIGHTMAP)
35  float height;
36#endif
37#if defined(_DEBUG_VIEW_TANGENT_SPACE_NORMALS)
38  float3 tangent_normal;
39#endif
40};
41
42struct LightCommon {
43  float3 V;
44  float3 N;
45  float NoV;
46  float ao;
47  float spec_ao;
48#if defined(_CLEARCOAT)
49  float NoV_cc;
50#endif
51};
52
53struct LightDirect {
54  float3 dir;
55
56  float3 H;
57  float NoH;
58  float NoL;
59#if defined(_CLEARCOAT)
60  float NoH_cc;
61  float NoL_cc;
62#endif
63  float LoH;
64  float LoV;
65  float double_LoV;
66
67  float3 color;
68};
69
70struct LightIndirect {
71  float3 dir;
72
73  float3 H;
74  float NoH;
75  float NoL;
76  float LoH;
77  float LoV;
78  float double_LoV;
79
80  float3 specular;
81#if defined(_CLEARCOAT)
82  float3 specular_cc;
83#endif
84  float3 diffuse;
85#if defined(_SHADOWS) || defined(_SSFD)
86  float3 diffuse_dominant_dir;
87#endif
88
89  float3 L00;
90  float3 L01r;
91  float3 L01g;
92  float3 L01b;
93};
94
95struct LightData {
96  LightCommon common;
97  LightDirect direct;
98  LightIndirect indirect;
99#if defined(_GLITTER)
100  float2 glitter_uv;
101  LightGlitter glitter;
102#endif
103};
104
105struct BrdfData {
106  float direct_d;
107  float3 direct_f;
108  float direct_g;
109
110#if defined(_CLEARCOAT)
111  float direct_d_cc;
112  float direct_f_cc;
113  float direct_g_cc;
114#endif
115
116  float4 ibl_dfg;
117#if defined(_CLEARCOAT)
118  float4 ibl_dfg_cc;
119#endif
120};
121
122#endif  // __DATA_INC