public static GUIContent thicknessMapText = new GUIContent ( "Thickness map (R)" , "If subsurface scattering is enabled, low values allow some light to be transmitted through the object." ) ;
public static GUIContent thicknessRemapText = new GUIContent ( "Thickness Remap" , "Remaps values of the thickness map from [0, 1] to the specified range." ) ;
// Iridescence
public static GUIContent iorIridescenceText = new GUIContent ( "Iridescence IOR" ) ;
public static GUIContent thicknessIridescenceText = new GUIContent ( "Iridescence Thickness" ) ;
public static GUIContent thicknessMapIridescenceText = new GUIContent ( "Iridescence Thickness map" ) ;
public static GUIContent thicknessRemapIridescenceText = new GUIContent ( "Iridescence Thickness remap" ) ;
// Clear Coat
public static GUIContent coatMaskText = new GUIContent ( "Coat Mask" , "Attenuate the coating effect (similar to change to IOR of 1" ) ;
// Transparency
public static string refractionModeText = "Refraction Mode" ;
public static GUIContent refractionIOR Text = new GUIContent ( "Index of refraction" , "Index of refraction" ) ;
public static GUIContent refractionIor Text = 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 (m)" , "Thickness multiplier" ) ;
public static GUIContent refractionThicknessMapText = new GUIContent ( "Refraction Thickness Map (R)" , "Thickness multiplier" ) ;
protected MaterialProperty anisotropyMap = null ;
protected const string kAnisotropyMap = "_AnisotropyMap" ;
protected MaterialProperty iorIridescence = null ;
protected const string kIorIridescence = "_IorIridescence" ;
protected MaterialProperty thicknessIridescence = null ;
protected const string kThicknessIridescence = "_ThicknessIridescence" ;
protected MaterialProperty thicknessMapIridescence = null ;
protected const string kThicknessMapIridescence = "_ThicknessMapIridescence" ;
protected MaterialProperty thicknessRemapIridescence = null ;
protected const string kThicknessRemapIridescence = "_ThicknessRemapIridescence" ;
protected MaterialProperty coatMask = null ;
protected const string kCoatMask = "_CoatMask" ;
protected MaterialProperty coatMaskMap = null ;
// transparency params
protected MaterialProperty ior = null ;
protected const string kIOR = "_IOR " ;
protected const string kIor = "_Ior " ;
protected MaterialProperty transmittanceColor = null ;
protected const string kTransmittanceColor = "_TransmittanceColor" ;
protected MaterialProperty transmittanceColorMap = null ;
anisotropy = FindProperty ( kAnisotropy , props ) ;
anisotropyMap = FindProperty ( kAnisotropyMap , props ) ;
// Iridescence
iorIridescence = FindProperty ( kIorIridescence , props ) ;
thicknessIridescence = FindProperty ( kThicknessIridescence , props ) ;
thicknessMapIridescence = FindProperty ( kThicknessMapIridescence , props ) ;
thicknessRemapIridescence = FindProperty ( kThicknessRemapIridescence , props ) ;
// clear coat
coatMask = FindProperty ( kCoatMask , props ) ;
coatMaskMap = FindProperty ( kCoatMaskMap , props ) ;
transmittanceColorMap = FindProperty ( kTransmittanceColorMap , props , false ) ;
atDistance = FindProperty ( kATDistance , props , false ) ;
thicknessMultiplier = FindProperty ( kThicknessMultiplier , props , false ) ;
ior = FindProperty ( kIOR , props , false ) ;
ior = FindProperty ( kIor , props , false ) ;
// We reuse thickness from SSS
}
}
}
}
protected void ShaderIridescenceInputGUI ( )
{
m_MaterialEditor . ShaderProperty ( iorIridescence , Styles . iorIridescenceText ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . thicknessMapIridescenceText , thicknessMapIridescence ) ;
if ( thicknessMapIridescence . textureValue ! = null )
{
// Display the remap of texture values.
Vector2 remap = thicknessRemapIridescence . vectorValue ;
EditorGUI . BeginChangeCheck ( ) ;
EditorGUILayout . MinMaxSlider ( Styles . thicknessRemapIridescenceText , ref remap . x , ref remap . y , 0.0f , 1.0f ) ;
if ( EditorGUI . EndChangeCheck ( ) )
{
thicknessRemapIridescence . vectorValue = remap ;
}
}
else
{
// Allow the user to set the constant value of thickness if no thickness map is provided.
m_MaterialEditor . ShaderProperty ( thicknessIridescence , Styles . thicknessIridescenceText ) ;
}
}
protected void ShaderClearCoatInputGUI ( )
{
case BaseLitGUI . MaterialId . LitSpecular :
ShaderSpecularColorInputGUI ( material ) ;
break ;
case BaseLitGUI . MaterialId . LitIridescence :
ShaderIridescenceInputGUI ( ) ;
break ;
default :
Debug . Assert ( false , "Encountered an unsupported MaterialID." ) ;
var mode = ( Lit . RefractionMode ) refractionMode . floatValue ;
if ( mode ! = Lit . RefractionMode . None )
{
m_MaterialEditor . ShaderProperty ( ior , Styles . refractionIOR Text ) ;
m_MaterialEditor . ShaderProperty ( ior , Styles . refractionIor Text ) ;
blendMode . floatValue = ( float ) BlendMode . Alpha ;