public static GUIContent alphaCutoffShadowText = new GUIContent ( "Alpha Cutoff Shadow" , "Threshold for alpha cutoff in case of shadow pass" ) ;
public static GUIContent alphaCutoffPrepassText = new GUIContent ( "Alpha Cutoff Prepass" , "Threshold for alpha cutoff in case of depth prepass" ) ;
public static GUIContent transparentDepthPrepassEnableText = new GUIContent ( "Enable transparent depth prepass" , "It allow to " ) ;
public static GUIContent enableTransparentFogText = new GUIContent ( "Enable Fog " ) ;
public static GUIContent enableBlendModeAccurate LightingText = new GUIContent ( "Blend only diffuse lighting" , "Blend mode will only affect diffuse lighting, allowing correct specular lighting (reflection) on transparent object" ) ;
public static GUIContent enableTransparentFogText = new GUIContent ( "Enable fog" , "Enable fog on transparent material " ) ;
public static GUIContent enableBlendModePreserveSpecular LightingText = new GUIContent ( "Blend preserve specular lighting" , "Blend mode will only affect diffuse lighting, allowing correct specular lighting (reflection) on transparent object" ) ;
public static GUIContent doubleSidedEnableText = new GUIContent ( "Double Sided" , "This will render the two face of the objects (disable backface culling) and flip/mirror normal" ) ;
public static GUIContent distortionEnableText = new GUIContent ( "Distortion" , "Enable distortion on this shader" ) ;
protected const string kDistortionBlurRemapMax = "_DistortionBlurRemapMax" ;
protected MaterialProperty preRefractionPass = null ;
protected const string kPreRefractionPass = "_PreRefractionPass" ;
protected MaterialProperty enableTransparentFog = null ;
protected const string kEnableTransparentFog = "_EnableTransparentFog " ;
protected MaterialProperty enableBlendModeAccurate Lighting = null ;
protected const string kEnableBlendModeAccurateLighting = "_EnableBlendModeAccurate Lighting" ;
protected MaterialProperty enableFogOn Transparent = null ;
protected const string kEnableFogOn Transparent = "_EnableFogOn Transparent" ;
protected MaterialProperty enableBlendModePreserveSpecular Lighting = null ;
protected const string kEnableBlendModePreserveSpecularLighting = "_EnableBlendModePreserveSpecular Lighting" ;
// See comment in LitProperties.hlsl
distortionBlurRemapMax = FindProperty ( kDistortionBlurRemapMax , props , false ) ;
preRefractionPass = FindProperty ( kPreRefractionPass , props , false ) ;
enableTransparentFog = FindProperty ( kEnableTransparentFog , props , false ) ;
enableBlendModeAccurate Lighting = FindProperty ( kEnableBlendModeAccurate Lighting , props , false ) ;
enableFogOn Transparent = FindProperty ( kEnableFogOn Transparent , props , false ) ;
enableBlendModePreserveSpecular Lighting = FindProperty ( kEnableBlendModePreserveSpecular Lighting , props , false ) ;
}
void SurfaceTypePopup ( )
BlendModePopup ( ) ;
EditorGUI . indentLevel + + ;
if ( enableBlendModeAccurate Lighting ! = null & & blendMode ! = null & & showBlendModePopup )
m_MaterialEditor . ShaderProperty ( enableBlendModeAccurate Lighting , StylesBaseUnlit . enableBlendModeAccurate LightingText ) ;
if ( enableTransparentFog ! = null )
m_MaterialEditor . ShaderProperty ( enableTransparentFog , StylesBaseUnlit . enableTransparentFogText ) ;
if ( enableBlendModePreserveSpecular Lighting ! = null & & blendMode ! = null & & showBlendModePopup )
m_MaterialEditor . ShaderProperty ( enableBlendModePreserveSpecular Lighting , StylesBaseUnlit . enableBlendModePreserveSpecular LightingText ) ;
if ( enableFogOn Transparent ! = null )
m_MaterialEditor . ShaderProperty ( enableFogOn Transparent , StylesBaseUnlit . enableTransparentFogText ) ;
if ( preRefractionPass ! = null )
m_MaterialEditor . ShaderProperty ( preRefractionPass , StylesBaseUnlit . transparentPrePassText ) ;
EditorGUI . indentLevel - - ;
SurfaceType surfaceType = ( SurfaceType ) material . GetFloat ( kSurfaceType ) ;
SetKeyword ( material , "_SURFACE_TYPE_TRANSPARENT" , surfaceType = = SurfaceType . Transparent ) ;
bool enableBlendModeAccurate Lighting = material . HasProperty ( kEnableBlendModeAccurate Lighting ) & & material . GetFloat ( kEnableBlendModeAccurate Lighting ) > 0.0f ;
SetKeyword ( material , "_BLENDMODE_ACCURATE_LIGHTING" , enableBlendModeAccurate Lighting ) ;
bool enableBlendModePreserveSpecular Lighting = material . HasProperty ( kEnableBlendModePreserveSpecular Lighting ) & & material . GetFloat ( kEnableBlendModePreserveSpecular Lighting ) > 0.0f ;
SetKeyword ( material , "_BLENDMODE_PRESERVE_SPECULAR_LIGHTING" , enableBlendModePreserveSpecular Lighting ) ;
// These need to always been set either with opaque or transparent! So a users can switch to opaque and remove the keyword correctly
SetKeyword ( material , "_BLENDMODE_ALPHA" , false ) ;
SetKeyword ( material , "_DOUBLESIDED_ON" , doubleSidedEnable ) ;
bool fogEnabled = material . HasProperty ( kEnableTransparentFog ) & & material . GetFloat ( kEnableTransparentFog ) > 0.0f ;
SetKeyword ( material , "_ENABLE_TRANSPARENT_FOG " , fogEnabled ) ;
bool fogEnabled = material . HasProperty ( kEnableFogOn Transparent ) & & material . GetFloat ( kEnableFogOn Transparent ) > 0.0f & & surfaceType = = SurfaceType . Transparent ;
SetKeyword ( material , "_ENABLE_FOG_ON_ TRANSPARENT" , fogEnabled ) ;
if ( material . HasProperty ( kDistortionEnable ) )
{