diff options
| -rwxr-xr-x | 3ner.shader | 10 | ||||
| -rwxr-xr-x | features.cginc | 6 | ||||
| -rw-r--r-- | filamented.cginc | 11 | ||||
| -rwxr-xr-x | globals.cginc | 6 | ||||
| -rwxr-xr-x | pbr.cginc | 2 |
5 files changed, 33 insertions, 2 deletions
diff --git a/3ner.shader b/3ner.shader index 75499d7..2fd6b94 100755 --- a/3ner.shader +++ b/3ner.shader @@ -41,6 +41,14 @@ Shader "yum_food/3ner" [HideInInspector] m_start_IBL("Image-based lighting", Float) = 0 _Exposure_Occlusion("Exposure Occlusion", Range(0.001, 10)) = 1 + //ifex _Custom_Cubemap_Enabled==0 + [HideInInspector] m_start_Custom_Cubemap("Custom Cubemap", Float) = 0 + [ThryToggle(_CUSTOM_CUBEMAP)] _Custom_Cubemap_Enable_Static("Enable (static)", Float) = 0 + [DoNotLock] [ToggleUI] _Custom_Cubemap_Enable_Dynamic("Enable (dynamic)", Float) = 0 + [NoScaleOffset] _Custom_Cubemap("Cubemap (HDR)", Cube) = "" {} + [HideInInspector] m_end_Custom_Cubemap("Custom Cubemap", Float) = 0 + //endex + //ifex _Bent_Normals_Enabled==0 [HideInInspector] m_start_Bent_Normals("Bent Normals", Float) = 0 [ThryToggle(_BENT_NORMALS)] _Bent_Normals_Enabled("Enable", Float) = 0 @@ -712,7 +720,7 @@ Shader "yum_food/3ner" _Glitter_Roughness("Roughness", Range(0.001, 0.1)) = 0.01 [IntRange] _Glitter_Angular_Cells("Angular Cells", Range(1, 4)) = 4 _Glitter_Filter_Size("Filter Size", Range(0.1, 2.0)) = 0.7 - _Glitter_Tint("Tint", Color) = (1, 1, 1, 1) + [HDR] _Glitter_Tint("Tint", Color) = (1, 1, 1, 1) [IntRange] _Glitter_UV_Channel("UV Channel", Range(0, 3)) = 0 //ifex _Glitter_Mask_Enabled==0 diff --git a/features.cginc b/features.cginc index 5d560a6..819a9bf 100755 --- a/features.cginc +++ b/features.cginc @@ -1,6 +1,12 @@ #ifndef __FEATURES_INC #define __FEATURES_INC +//ifex _Custom_Cubemap_Enabled==0 +#if defined(FORWARD_BASE_PASS) || defined(OUTLINES_PASS) +#pragma shader_feature_local _CUSTOM_CUBEMAP +#endif +//endex + //ifex _Emissions_Enabled==0 #pragma shader_feature_local _EMISSIONS //endex diff --git a/filamented.cginc b/filamented.cginc index c760b79..b5d2ea4 100644 --- a/filamented.cginc +++ b/filamented.cginc @@ -267,6 +267,17 @@ inline half3 UnityGI_prefilteredRadiance(const UnityGIInput data, const float pe glossIn.roughness = perceptualRoughness; glossIn.reflUVW = r; + #if defined(_CUSTOM_CUBEMAP) && !defined(_GLOSSYREFLECTIONS_OFF) + UNITY_BRANCH + if (_Custom_Cubemap_Enable_Dynamic) + { + return Unity_GlossyEnvironment_local( + UNITY_PASS_TEXCUBE(_Custom_Cubemap), + _Custom_Cubemap_HDR, + glossIn); + } + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION // we will tweak reflUVW in glossIn directly (as we pass it to Unity_GlossyEnvironment twice for probe0 and probe1), so keep original to pass into BoxProjectedCubemapDirection half3 originalReflUVW = glossIn.reflUVW; diff --git a/globals.cginc b/globals.cginc index efa8670..a51c3af 100755 --- a/globals.cginc +++ b/globals.cginc @@ -31,6 +31,12 @@ float _Metallic; float _Exposure_Occlusion; +#if defined(_CUSTOM_CUBEMAP) +UNITY_DECLARE_TEXCUBE(_Custom_Cubemap); +half4 _Custom_Cubemap_HDR; +float _Custom_Cubemap_Enable_Dynamic; +#endif // _CUSTOM_CUBEMAP + texture2D _DFG_LUT; float _Specular_AA_Variance; float _Specular_AA_Threshold; @@ -116,7 +116,7 @@ float normalFiltering(float3 geometric_normal, float perceptual_roughness) { } void propagateSmoothness(inout Pbr pbr) { - pbr.smoothness = 1.0f - normalFiltering(pbr.geometric_normal, 1.0f - pbr.smoothness); + pbr.smoothness = 1.0f - normalFiltering(pbr.normal, 1.0f - pbr.smoothness); pbr.roughness_perceptual = clamp(1.0f - pbr.smoothness, MIN_PERCEPTUAL_ROUGHNESS, 1); pbr.roughness = clamp(pbr.roughness_perceptual * pbr.roughness_perceptual, MIN_ROUGHNESS, 1); |
