diff options
Diffstat (limited to 'Shaders/PBS_lighting.cginc')
| -rw-r--r-- | Shaders/PBS_lighting.cginc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Shaders/PBS_lighting.cginc b/Shaders/PBS_lighting.cginc index d41d44b..13bde82 100644 --- a/Shaders/PBS_lighting.cginc +++ b/Shaders/PBS_lighting.cginc @@ -38,6 +38,9 @@ float4 BG_Metallic_ST; float4 BG_Smoothness_ST; float4 BG_Emission_Mask_ST; +float Enable_Custom_Cubemap; +UNITY_DECLARE_TEXCUBE(Custom_Cubemap); + void getVertexLightColor(inout v2f i) { #if defined(VERTEXLIGHT_ON) @@ -206,10 +209,18 @@ UnityIndirect GetIndirect(v2f i, float3 view_dir, float smoothness) { // There's a nonlinear relationship between mipmap level and roughness. float roughness = 1 - smoothness; roughness *= 1.7 - .7 * roughness; - float3 env_sample = UNITY_SAMPLE_TEXCUBE_LOD( - unity_SpecCube0, - reflect_dir, - roughness * UNITY_SPECCUBE_LOD_STEPS); + float3 env_sample; + if (Enable_Custom_Cubemap) { + env_sample = UNITY_SAMPLE_TEXCUBE_LOD( + Custom_Cubemap, + reflect_dir, + roughness * UNITY_SPECCUBE_LOD_STEPS); + } else { + env_sample = UNITY_SAMPLE_TEXCUBE_LOD( + unity_SpecCube0, + reflect_dir, + roughness * UNITY_SPECCUBE_LOD_STEPS); + } indirect.specular = env_sample; #endif |
