public static string refractionModeText = "Refraction Mode" ;
public static GUIContent refractionIORText = new GUIContent ( "Index of refraction" , "Index of refraction" ) ;
public static GUIContent refractionThicknessText = new GUIContent ( "Refraction Thickness" , "Thickness for rough refraction" ) ;
public static GUIContent refractionThicknessMultiplierText = new GUIContent ( "Refraction Thickness multiplier" , "Thickness multiplier" ) ;
public static GUIContent refractionThicknessMultiplierText = new GUIContent ( "Refraction Thickness multiplier (m) " , "Thickness multiplier" ) ;
public static GUIContent atDistanceText = new GUIContent ( "Transmittance Absorption Distance" , "Absorption distance reference" ) ;
public static GUIContent atDistanceText = new GUIContent ( "Transmittance Absorption Distance (m) " , "Absorption distance reference" ) ;
public static GUIContent perPixelDisplacementDetailsWarning = new GUIContent ( "For pixel displacement to work correctly, details and base map must use same UV mapping" ) ;
}
protected const string kIOR = "_IOR" ;
protected MaterialProperty transmittanceColor = null ;
protected const string kTransmittanceColor = "_TransmittanceColor" ;
protected MaterialProperty transmittanceColorMap = null ;
protected const string kTransmittanceColorMap = "_TransmittanceColorMap" ;
protected MaterialProperty atDistance = null ;
protected const string kATDistance = "_ATDistance" ;
protected MaterialProperty thicknessMultiplier = null ;
// Transparency
refractionMode = FindProperty ( kRefractionMode , props , false ) ;
transmittanceColor = FindProperty ( kTransmittanceColor , props , false ) ;
transmittanceColorMap = FindProperty ( kTransmittanceColorMap , props , false ) ;
atDistance = FindProperty ( kATDistance , props , false ) ;
thicknessMultiplier = FindProperty ( kThicknessMultiplier , props , false ) ;
ior = FindProperty ( kIOR , props , false ) ;
var mode = ( Lit . RefractionMode ) refractionMode . floatValue ;
if ( mode ! = Lit . RefractionMode . None )
{
+ + EditorGUI . indentLevel ;
m_MaterialEditor . ShaderProperty ( ior , Styles . refractionIORText ) ;
blendMode . floatValue = ( float ) BlendMode . Alpha ;
m_MaterialEditor . ShaderProperty ( thicknessMultiplier , Styles . refractionThicknessMultiplierText ) ;
- - EditorGUI . indentLevel ;
m_MaterialEditor . ShaderProperty ( transmittanceColor , Styles . transmittanceColorText ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . transmittanceColorText , transmittanceColorMap , transmittanceColor ) ;
- - EditorGUI . indentLevel ;
- - EditorGUI . indentLevel ;
}
}
var canHaveRefraction = ! material . HasProperty ( kPreRefractionPass ) | | material . GetFloat ( kPreRefractionPass ) < = 0.0 ;
SetKeyword ( material , "_REFRACTION_PLANE" , ( refractionModeValue = = Lit . RefractionMode . Plane ) & & canHaveRefraction ) ;
SetKeyword ( material , "_REFRACTION_SPHERE" , ( refractionModeValue = = Lit . RefractionMode . Sphere ) & & canHaveRefraction ) ;
SetKeyword ( material , "_TRANSMITTANCECOLORMAP" , material . GetTexture ( kTransmittanceColorMap ) & & canHaveRefraction ) ;
}
}
} // namespace UnityEditor