52 lines
2.1 KiB
HLSL

#ifndef SCSS_CONFIG_INCLUDED
#define SCSS_CONFIG_INCLUDED
// Perform full-quality light calculations on unimportant lights.
// Considering our target GPUs, this is a big visual improvement
// for a small performance penalty.
#define SCSS_UNIMPORTANT_LIGHTS_FRAGMENT 1
// When rendered by a non-HDR camera, clamp incoming lighting.
// This works around issues where scenes are set up incorrectly
// for non-HDR.
#define SCSS_CLAMP_IN_NON_HDR 1
// When screen-space shadows are used in the scene, performs a
// search to find the best sampling point for the shadow
// using the camera's depth buffer. This filters away many aliasing
// artifacts caused by limitations in the screen shadow technique
// used by directional lights.
#define SCSS_SCREEN_SHADOW_FILTER 1
// Safety net for things that can't be used in Standard's codepaths on weaker hardware
// Following implementation in Unity 2020's built-in pipeline
#if defined(SHADER_TARGET_SURFACE_ANALYSIS)
// For surface shader code analysis pass, disable some features that don't affect inputs/outputs
#undef UNITY_SPECCUBE_BOX_PROJECTION
#undef UNITY_SPECCUBE_BLENDING
#undef UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
#elif SHADER_TARGET < 30
#undef UNITY_SPECCUBE_BOX_PROJECTION
#undef UNITY_SPECCUBE_BLENDING
#undef UNITY_ENABLE_DETAIL_NORMALMAP
#ifdef _PARALLAXMAP
#undef _PARALLAXMAP
#endif
#endif
#if (SHADER_TARGET < 30) || defined(SHADER_API_GLES)
#undef UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
#endif
#ifndef UNITY_SAMPLE_FULL_SH_PER_PIXEL
// Lightmap UVs and ambient color from SHL2 are shared in the vertex to pixel interpolators. Do full SH evaluation in the pixel shader when static lightmap and LIGHTPROBE_SH is enabled.
#define UNITY_SAMPLE_FULL_SH_PER_PIXEL (LIGHTMAP_ON && LIGHTPROBE_SH)
// Shaders might fail to compile due to shader instruction count limit. Leave only baked lightmaps on SM20 hardware.
#if UNITY_SAMPLE_FULL_SH_PER_PIXEL && (SHADER_TARGET < 25)
#undef UNITY_SAMPLE_FULL_SH_PER_PIXEL
#undef LIGHTPROBE_SH
#endif
#endif
#endif // SCSS_CONFIG_INCLUDED