protected MaterialProperty [ ] heightMax = new MaterialProperty [ kMaxLayerCount ] ;
protected const string kHeightMax = "_HeightMax" ;
protected MaterialProperty [ ] subsurfaceProfileID = new MaterialProperty [ kMaxLayerCount ] ;
protected const string kSubsurfaceProfileID = "_SubsurfaceProfile" ;
protected MaterialProperty [ ] subsurfaceRadius = new MaterialProperty [ kMaxLayerCount ] ;
protected const string kSubsurfaceRadius = "_SubsurfaceRadius" ;
protected MaterialProperty [ ] subsurfaceRadiusMap = new MaterialProperty [ kMaxLayerCount ] ;
protected const string kSubsurfaceRadiusMap = "_SubsurfaceRadiusMap" ;
protected MaterialProperty [ ] thickness = new MaterialProperty [ kMaxLayerCount ] ;
protected const string kThickness = "_Thickness" ;
protected MaterialProperty [ ] thicknessMap = new MaterialProperty [ kMaxLayerCount ] ;
protected const string kThicknessMap = "_ThicknessMap" ;
protected MaterialProperty [ ] UVDetail = new MaterialProperty [ kMaxLayerCount ] ;
protected const string kUVDetail = "_UVDetail" ;
protected MaterialProperty [ ] UVDetailsMappingMask = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty anisotropyMap = null ;
protected const string kAnisotropyMap = "_AnisotropyMap" ;
protected MaterialProperty subsurfaceProfileID = null ;
protected const string kSubsurfaceProfileID = "_SubsurfaceProfile" ;
protected MaterialProperty subsurfaceRadius = null ;
protected const string kSubsurfaceRadius = "_SubsurfaceRadius" ;
protected MaterialProperty subsurfaceRadiusMap = null ;
protected const string kSubsurfaceRadiusMap = "_SubsurfaceRadiusMap" ;
protected MaterialProperty thickness = null ;
protected const string kThickness = "_Thickness" ;
protected MaterialProperty thicknessMap = null ;
protected const string kThicknessMap = "_ThicknessMap" ;
protected MaterialProperty coatCoverage = null ;
protected const string kCoatCoverage = "_CoatCoverage" ;
protected MaterialProperty coatIOR = null ;
heightMax [ i ] = FindProperty ( string . Format ( "{0}{1}" , kHeightMax , m_PropertySuffixes [ i ] ) , props ) ;
heightCenter [ i ] = FindProperty ( string . Format ( "{0}{1}" , kHeightCenter , m_PropertySuffixes [ i ] ) , props ) ;
// Sub surface
subsurfaceProfileID [ i ] = FindProperty ( string . Format ( "{0}{1}" , kSubsurfaceProfileID , m_PropertySuffixes [ i ] ) , props ) ;
subsurfaceRadius [ i ] = FindProperty ( string . Format ( "{0}{1}" , kSubsurfaceRadius , m_PropertySuffixes [ i ] ) , props ) ;
subsurfaceRadiusMap [ i ] = FindProperty ( string . Format ( "{0}{1}" , kSubsurfaceRadiusMap , m_PropertySuffixes [ i ] ) , props ) ;
thickness [ i ] = FindProperty ( string . Format ( "{0}{1}" , kThickness , m_PropertySuffixes [ i ] ) , props ) ;
thicknessMap [ i ] = FindProperty ( string . Format ( "{0}{1}" , kThicknessMap , m_PropertySuffixes [ i ] ) , props ) ;
// Details
UVDetail [ i ] = FindProperty ( string . Format ( "{0}{1}" , kUVDetail , m_PropertySuffixes [ i ] ) , props ) ;
UVDetailsMappingMask [ i ] = FindProperty ( string . Format ( "{0}{1}" , kUVDetailsMappingMask , m_PropertySuffixes [ i ] ) , props ) ;
tangentMapOS = FindProperty ( kTangentMapOS , props ) ;
anisotropy = FindProperty ( kAnisotropy , props ) ;
anisotropyMap = FindProperty ( kAnisotropyMap , props ) ;
// Sub surface
subsurfaceProfileID = FindProperty ( kSubsurfaceProfileID , props ) ;
subsurfaceRadius = FindProperty ( kSubsurfaceRadius , props ) ;
subsurfaceRadiusMap = FindProperty ( kSubsurfaceRadiusMap , props ) ;
thickness = FindProperty ( kThickness , props ) ;
thicknessMap = FindProperty ( kThicknessMap , props ) ;
// clear coat
coatCoverage = FindProperty ( kCoatCoverage , props ) ;
// We reuse thickness from SSS
}
protected void ShaderSSSInputGUI ( Material material )
protected void ShaderSSSInputGUI ( Material material , int layerIndex )
{
var hdPipeline = RenderPipelineManager . currentPipeline as HDRenderPipeline ;
var sssSettings = hdPipeline . sssSettings ;
using ( var scope = new EditorGUI . ChangeCheckScope ( ) )
{
int profileID = ( int ) subsurfaceProfileID . floatValue ;
int profileID = ( int ) subsurfaceProfileID [ layerIndex ] . floatValue ;
using ( new EditorGUILayout . HorizontalScope ( ) )
{
}
if ( scope . changed )
subsurfaceProfileID . floatValue = profileID ;
subsurfaceProfileID [ layerIndex ] . floatValue = profileID ;
m_MaterialEditor . ShaderProperty ( subsurfaceRadius , Styles . subsurfaceRadiusText ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . subsurfaceRadiusMapText , subsurfaceRadiusMap ) ;
m_MaterialEditor . ShaderProperty ( thickness , Styles . thicknessText ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . thicknessMapText , thicknessMap ) ;
m_MaterialEditor . ShaderProperty ( subsurfaceRadius [ layerIndex ] , Styles . subsurfaceRadiusText ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . subsurfaceRadiusMapText , subsurfaceRadiusMap [ layerIndex ] ) ;
m_MaterialEditor . ShaderProperty ( thickness [ layerIndex ] , Styles . thicknessText ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . thicknessMapText , thicknessMap [ layerIndex ] ) ;
}
protected void ShaderClearCoatInputGUI ( )
EditorGUI . indentLevel + + ;
bool refractionEnable = refractionMode . floatValue > 0.0f & & preRefractionPass . floatValue = = 0.0f ;
bool refractionEnable = ( material . HasProperty ( kRefractionMode ) & & refractionMode . floatValue > 0.0f ) & & ( material . HasProperty ( kPreRefractionPass ) & & preRefractionPass . floatValue = = 0.0f ) ;
if ( materialID = = null | | // Will be the case for Layered materials where we only support standard and the parameter does not exist
( Lit . MaterialId ) materialID . floatValue = = Lit . MaterialId . LitStandard | | ( Lit . MaterialId ) materialID . floatValue = = Lit . MaterialId . LitAniso )
if ( ( Lit . MaterialId ) materialID . floatValue = = Lit . MaterialId . LitStandard | | ( Lit . MaterialId ) materialID . floatValue = = Lit . MaterialId . LitAniso )
{
m_MaterialEditor . ShaderProperty ( metallic [ layerIndex ] , Styles . metallicText ) ;
}
}
}
m_MaterialEditor . TexturePropertySingleLine ( ( materialID ! = null & & ( Lit . MaterialId ) materialID . floatValue = = Lit . MaterialId . LitSpecular ) ? Styles . maskMapSpecularText : Styles . maskMapSText , maskMap [ layerIndex ] ) ;
m_MaterialEditor . TexturePropertySingleLine ( ( ( Lit . MaterialId ) materialID . floatValue = = Lit . MaterialId . LitSpecular ) ? Styles . maskMapSpecularText : Styles . maskMapSText , maskMap [ layerIndex ] ) ;
m_MaterialEditor . ShaderProperty ( normalMapSpace [ layerIndex ] , Styles . normalMapSpaceText ) ;
heightAmplitude [ layerIndex ] . floatValue = ( heightMax [ layerIndex ] . floatValue - heightMin [ layerIndex ] . floatValue ) * 0.01f ; // Conversion centimeters to meters.
}
if ( materialID ! = null )
{
ShaderSSSInputGUI ( material ) ;
ShaderSSSInputGUI ( material , layerIndex ) ;
// Following mode are not supported by layered lit and will not be call by it
// as the MaterialId enum don't define it
case Lit . MaterialId . LitAniso :
ShaderAnisoInputGUI ( ) ;
break ;
default :
Debug . Assert ( false , "Encountered an unsupported MaterialID." ) ;
break ;
}
}
EditorGUILayout . Space ( ) ;
if ( mode ! = Lit . RefractionMode . ThinPlane )
{
if ( thicknessMap . textureValue = = null )
m_MaterialEditor . ShaderProperty ( thickness , Styles . refractionThicknessText ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . refractionThicknessMapText , thicknessMap ) ;
if ( thicknessMap [ 0 ] . textureValue = = null )
m_MaterialEditor . ShaderProperty ( thickness [ 0 ] , Styles . refractionThicknessText ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . refractionThicknessMapText , thicknessMap [ 0 ] ) ;
+ + EditorGUI . indentLevel ;
m_MaterialEditor . ShaderProperty ( thicknessMultiplier , Styles . refractionThicknessMultiplierText ) ;