summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x3ner.shader9
-rwxr-xr-x3ner.shader.meta13
-rwxr-xr-xbrdf.cginc82
-rwxr-xr-xfeatures.cginc4
-rwxr-xr-xglobals.cginc6
-rwxr-xr-xpbr.cginc8
6 files changed, 10 insertions, 112 deletions
diff --git a/3ner.shader b/3ner.shader
index 926f408..10b0e9c 100755
--- a/3ner.shader
+++ b/3ner.shader
@@ -490,15 +490,6 @@ Shader "yum_food/3ner"
//endex
[HideInInspector] m_end_Clearcoat("Clearcoat", Float) = 0
//endex
-
- //ifex _Cloth_Sheen_Enabled==0
- [HideInInspector] m_start_Cloth_Sheen("Cloth Sheen", Float) = 0
- [ThryToggle(_CLOTH_SHEEN)] _Cloth_Sheen_Enabled("Enable", Float) = 0
- _Cloth_Sheen_DFG_LUT("Cloth DFG LUT", 2D) = "white" {}
- _Cloth_Sheen_Strength("Strength", Range(0, 1)) = 0
- _Cloth_Sheen_Color("Color", Color) = (1, 1, 1, 1)
- [HideInInspector] m_end_Cloth_Sheen("Cloth Sheen", Float) = 0
- //endex
[HideInInspector] m_end_BRDF("BRDF", Float) = 0
[HideInInspector] m_start_blending ("Blending--{button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/rendering/blending},hover:Documentation}}", Float) = 0
diff --git a/3ner.shader.meta b/3ner.shader.meta
index 6cfcf99..c03debd 100755
--- a/3ner.shader.meta
+++ b/3ner.shader.meta
@@ -6,13 +6,20 @@ ShaderImporter:
- _MainTex: {instanceID: 0}
- _BumpMap: {instanceID: 0}
- _MetallicGlossMap: {instanceID: 0}
+ - _DetailNormalMap: {instanceID: 0}
+ - _DetailMask: {instanceID: 0}
- _Center_Offset_Heightmap: {instanceID: 0}
- _Marble_U_Ramp: {instanceID: 0}
- _Marble_V_Ramp: {instanceID: 0}
- _Marble_W_Ramp: {instanceID: 0}
- - _DFG_LUT: {fileID: 2800000, guid: b6b1f1fa6be1ce54f8bcd5428c160a28, type: 3}
- - _Cloth_Sheen_DFG_LUT: {fileID: 2800000, guid: 59729cfaee66a3c4d847e732c7f99272,
- type: 3}
+ - _Impostors_Atlas: {instanceID: 0}
+ - _Impostors_Normal_Atlas: {instanceID: 0}
+ - _Impostors_Metallic_Gloss_Depth_Atlas: {instanceID: 0}
+ - _Instance_Texture_Offset_Data_Tex: {instanceID: 0}
+ - _Parallax_Heightmap: {instanceID: 0}
+ - _DFG_LUT: {fileID: 2800000, guid: d6fbf383c1bdb87439939bf17f69d539, type: 3}
+ - _Clearcoat_Mask: {instanceID: 0}
+ - _Cloth_Sheen_DFG_LUT: {instanceID: 0}
nonModifiableTextures: []
userData:
assetBundleName:
diff --git a/brdf.cginc b/brdf.cginc
index d064823..bd44b3f 100755
--- a/brdf.cginc
+++ b/brdf.cginc
@@ -66,67 +66,6 @@ float G_GGXSmith(float roughness, float NoL, float NoV) {
return rcp(denom);
}
-#if defined(_CLOTH_SHEEN)
-// Estevez "Production Friendly Microfacet Sheen BRDF"
-// Equation 2.
-// The original equation is:
-// (2 + 1/r) * sin^(1-r)(theta) / (2 pi)
-// Recall that:
-// cos^2(theta) + sin^2(theta) = 1
-// So:
-// sin^2(theta) = 1 - cos^2(theta)
-// sin(theta) = (1 - cos^2(theta)) ^ (1/2)
-// sin^k(theta) = (1 - cos^2(theta)) ^ (k/2)
-float D_Cloth(float roughness, float NoH) {
- float r_rcp = rcp(roughness);
- return (2.0f + r_rcp) * pow(1.0f - NoH * NoH, r_rcp * 0.5f) / TAU;
-}
-
-float G_Cloth_L(float x, float a, float b, float c, float d, float e) {
- return a / (1.0f + b * pow(x, c)) + d * x + e;
-}
-
-// Estevez "Production Friendly Microfacet Sheen BRDF"
-// Equations 3 and 4.
-float G_Cloth(float roughness, float LoH) {
- // Table 1
- float a0 = 25.3245f;
- float a1 = 21.5473f;
- float b0 = 3.32435f;
- float b1 = 3.82987f;
- float c0 = 0.16801f;
- float c1 = 0.19823f;
- float d0 = -1.27393f;
- float d1 = -1.97760f;
- float e0 = -4.85967f;
- float e1 = -4.32054f;
- float one_minus_r = 1.0f - roughness;
- float one_minus_r_sq = one_minus_r * one_minus_r;
- float one_minus_LoH = 1.0f - LoH;
-
- float lambda;
- [branch]
- if (LoH < 0.5f) {
- float L0 = G_Cloth_L(LoH, a0, b0, c0, d0, e0);
- float L1 = G_Cloth_L(LoH, a1, b1, c1, d1, e1);
- float L = lerp(L0, L1, one_minus_r_sq);
- lambda = exp(L);
- } else {
- float L_05_0 = G_Cloth_L(0.5f, a0, b0, c0, d0, e0);
- float L_05_1 = G_Cloth_L(0.5f, a1, b1, c1, d1, e1);
- float L_05 = lerp(L_05_0, L_05_1, one_minus_r_sq);
-
- float L_LoH_0 = G_Cloth_L(one_minus_LoH, a0, b0, c0, d0, e0);
- float L_LoH_1 = G_Cloth_L(one_minus_LoH, a1, b1, c1, d1, e1);
- float L_LoH = lerp(L_LoH_0, L_LoH_1, one_minus_r_sq);
-
- lambda = exp(2.0f * L_05 - L_LoH);
- }
- // Apply terminator softening (equation 4).
- return pow(lambda, 1.0f + 2.0f * pow(one_minus_LoH, 8));
-}
-#endif
-
float4 brdf(Pbr pbr, LightData data) {
float3 specular = 0;
float3 diffuse = 0;
@@ -192,17 +131,6 @@ float4 brdf(Pbr pbr, LightData data) {
layer_attenuation *= saturate(1.0f - Fcc * pbr.cc_strength);
#endif
-#if defined(_CLOTH_SHEEN)
- float cl_f0 = 0.04f;
- float Fcl = 1;
- float Dcl = D_Cloth(pbr.roughness, data.direct.NoH);
- float Gcl = G_Cloth(pbr.roughness, data.direct.LoH);
- float DFGcl = Fcl * Dcl * Gcl;
- float3 direct_specular_cl = DFGcl * data.direct.color * pbr.cl_strength * pbr.cl_color * data.direct.NoL;
- direct_specular_cl = max(0, direct_specular_cl);
- specular += direct_specular_cl;
-#endif
-
float3 F = F_Schlick(data.direct.LoH, f0_color, f90);
float D = D_GGX(pbr.roughness, data.direct.NoH);
float G = G_GGXSmith(pbr.roughness, data.direct.NoL, data.common.NoV);
@@ -238,16 +166,6 @@ float4 brdf(Pbr pbr, LightData data) {
remainder = saturate(remainder - indirect_specular_cc);
#endif
-#if defined(_CLOTH_SHEEN)
- float DFGcl = _Cloth_Sheen_DFG_LUT.Sample(bilinear_clamp_s, dfg_uv).r;
- float3 indirect_specular_cl = DFGcl * data.indirect.specular * pbr.cl_strength * pbr.cl_color;
- specular += indirect_specular_cl * remainder;
- // Energy conservation for cloth is tricky with IBL.
- // A simple approximation is to use the Fresnel of the sheen layer.
- float Fcl = F_Schlick(data.common.NoV, 0.04, 1.0);
- remainder -= Fcl * pbr.cl_strength;
-#endif
-
// Standard split-sum IBL
float3 f0_spec = lerp(f0, pbr.albedo.xyz, pbr.metallic);
float3 ibl_specular_reflectance = lerp(dfg.xxx, dfg.yyy, f0_spec);
diff --git a/features.cginc b/features.cginc
index 292e03c..3cf46e0 100755
--- a/features.cginc
+++ b/features.cginc
@@ -27,10 +27,6 @@
#pragma shader_feature_local _DETAILS
//endex
-//ifex _Cloth_Sheen_Enabled==0
-#pragma shader_feature_local _CLOTH_SHEEN
-//endex
-
//ifex _Vertex_Deformation_Enabled==0
#pragma shader_feature_local _VERTEX_DEFORMATION
#pragma shader_feature_local _VERTEX_DEFORMATION_FRAGMENT_NORMALS
diff --git a/globals.cginc b/globals.cginc
index d3a4b8e..0c4917d 100755
--- a/globals.cginc
+++ b/globals.cginc
@@ -69,12 +69,6 @@ float4 _DetailMask_ST;
int _Details_UV_Channel;
#endif // _DETAILS
-#if defined(_CLOTH_SHEEN)
-float _Cloth_Sheen_Strength;
-float3 _Cloth_Sheen_Color;
-texture2D _Cloth_Sheen_DFG_LUT;
-#endif // _CLOTH_SHEEN
-
#if defined(_UV_SCROLL)
float2 _UV_Scroll_Speed;
#endif // _UV_SCROLL
diff --git a/pbr.cginc b/pbr.cginc
index c8e58c8..d7d51b9 100755
--- a/pbr.cginc
+++ b/pbr.cginc
@@ -20,10 +20,6 @@ struct Pbr {
float cc_roughness;
float cc_strength;
#endif
-#if defined(_CLOTH_SHEEN)
- float cl_strength;
- float3 cl_color;
-#endif
#if defined(_IMPOSTORS_DEPTH)
float3 objPos;
float debug; // TODO rm
@@ -199,10 +195,6 @@ Pbr getPbr(v2f i) {
pbr.cc_roughness = _Clearcoat_Roughness;
pbr.cc_strength = _Clearcoat_Strength;
#endif
-#if defined(_CLOTH_SHEEN)
- pbr.cl_strength = _Cloth_Sheen_Strength;
- pbr.cl_color = _Cloth_Sheen_Color;
-#endif
propagateSmoothness(pbr);
return pbr;