Legacy Documentation: Version 2017.1 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

BuiltinShaderDefine

enumeration

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Defines set by editor when compiling shaders, depending on target platform and tier.

Variables

UNITY_NO_DXT5nmUNITY_NO_DXT5nm is set when compiling shader for platform that do not support DXT5NM, meaning that normal maps will be encoded in RGB instead.
UNITY_NO_RGBMUNITY_NO_RGBM is set when compiling shader for platform that do not support RGBM, so dLDR will be used instead.
UNITY_ENABLE_REFLECTION_BUFFERSUNITY_ENABLE_REFLECTION_BUFFERS is set when deferred shading renders reflection probes in deferred mode. With this option set reflections are rendered into a per-pixel buffer. This is similar to the way lights are rendered into a per-pixel buffer. UNITY_ENABLE_REFLECTION_BUFFERS is on by default when using deferred shading, but you can turn it off by setting “No support” for the Deferred Reflections shader option in Graphics Settings. When the setting is off, reflection probes are rendered per-object, similar to the way forward rendering works.
UNITY_FRAMEBUFFER_FETCH_AVAILABLEUNITY_FRAMEBUFFER_FETCH_AVAILABLE is set when compiling shaders for platforms where framebuffer fetch is potentially available.
UNITY_ENABLE_NATIVE_SHADOW_LOOKUPSUNITY_ENABLE_NATIVE_SHADOW_LOOKUPS enables use of built-in shadow comparison samplers on OpenGL ES 2.0.
UNITY_METAL_SHADOWS_USE_POINT_FILTERINGUNITY_METAL_SHADOWS_USE_POINT_FILTERING is set if shadow sampler should use point filtering on iOS Metal.
UNITY_NO_SCREENSPACE_SHADOWSUNITY_NO_SCREENSPACE_SHADOWS is set when screenspace cascaded shadow maps are disabled.
UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWSUNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS is set when Semitransparent Shadows are enabled.
UNITY_PBS_USE_BRDF1UNITY_PBS_USE_BRDF1 is set if Standard Shader BRDF1 should be used.
UNITY_PBS_USE_BRDF2UNITY_PBS_USE_BRDF2 is set if Standard Shader BRDF2 should be used.
UNITY_PBS_USE_BRDF3UNITY_PBS_USE_BRDF3 is set if Standard Shader BRDF3 should be used.
UNITY_NO_FULL_STANDARD_SHADERUNITY_NO_FULL_STANDARD_SHADER is set if Standard shader BRDF3 with extra simplifications should be used.
UNITY_SPECCUBE_BOX_PROJECTIONUNITY_SPECCUBE_BLENDING is set if Reflection Probes Box Projection is enabled.
UNITY_SPECCUBE_BLENDINGUNITY_SPECCUBE_BLENDING is set if Reflection Probes Blending is enabled.
UNITY_ENABLE_DETAIL_NORMALMAPUNITY_ENABLE_DETAIL_NORMALMAP is set if Detail Normal Map should be sampled if assigned.
SHADER_API_MOBILESHADER_API_MOBILE is set when compiling shader for mobile platforms.
SHADER_API_DESKTOPSHADER_API_DESKTOP is set when compiling shader for "desktop" platforms.
UNITY_HARDWARE_TIER1UNITY_HARDWARE_TIER1 is set when compiling shaders for GraphicsTier.Tier1.
UNITY_HARDWARE_TIER2UNITY_HARDWARE_TIER2 is set when compiling shaders for GraphicsTier.Tier2.
UNITY_HARDWARE_TIER3UNITY_HARDWARE_TIER3 is set when compiling shaders for GraphicsTier.Tier3.
UNITY_COLORSPACE_GAMMAUNITY_COLORSPACE_GAMMA is set when compiling shaders for Gamma Color Space.

Did you find this page useful? Please give it a rating: