[SerializeField]
public bool enableTransmission ;
[SerializeField]
public Vector2 thicknessM ap ;
public Vector2 thicknessRem ap ;
[SerializeField] [ HideInInspector ]
Vector4 [ ] m_FilterKernel ;
[SerializeField] [ HideInInspector ]
stdDev2 = new Color ( 0.6f , 0.6f , 0.6f , 0.0f ) ;
lerpWeight = 0.5f ;
enableTransmission = false ;
thicknessMap = new Vector2 ( 0 , 3 ) ;
thicknessRemap = new Vector2 ( 0 , 3 ) ;
UpdateKernelAndVarianceData ( ) ;
}
[SerializeField]
SubsurfaceScatteringProfile [ ] m_Profiles ;
[SerializeField]
float [ ] m_ThicknessM aps ;
float [ ] m_ThicknessRem aps ;
[SerializeField]
Vector4 [ ] m_HalfRcpVariancesAndLerpWeights ;
[SerializeField]
get { return m_TransmissionFlags ; }
}
// Supplies '_ThicknessM aps' to Lit.hlsl.
public float [ ] thicknessM aps
// Supplies '_ThicknessRem aps' to Lit.hlsl.
public float [ ] thicknessRem aps
get { return m_ThicknessM aps ; }
get { return m_ThicknessRem aps ; }
}
// Supplies '_HalfRcpVariancesAndLerpWeights' to Lit.hlsl.
m_NumProfiles = m_Profiles . Length ;
m_TransmissionFlags = 0 ;
if ( m_ThicknessM aps = = null )
if ( m_ThicknessRem aps = = null )
m_ThicknessM aps = new float [ maxNumProfiles * 2 ] ;
m_ThicknessRem aps = new float [ maxNumProfiles * 2 ] ;
}
if ( m_HalfRcpVariancesAndLerpWeights = = null )
m_Profiles [ i ] . lerpWeight = Mathf . Clamp01 ( m_Profiles [ i ] . lerpWeight ) ;
m_Profiles [ i ] . thicknessM ap . x = Mathf . Clamp ( m_Profiles [ i ] . thicknessM ap . x , 0 , m_Profiles [ i ] . thicknessM ap . y ) ;
m_Profiles [ i ] . thicknessM ap . y = Mathf . Max ( m_Profiles [ i ] . thicknessM ap . x , m_Profiles [ i ] . thicknessM ap . y ) ;
m_Profiles [ i ] . thicknessRem ap . x = Mathf . Clamp ( m_Profiles [ i ] . thicknessRem ap . x , 0 , m_Profiles [ i ] . thicknessRem ap . y ) ;
m_Profiles [ i ] . thicknessRem ap . y = Mathf . Max ( m_Profiles [ i ] . thicknessRem ap . x , m_Profiles [ i ] . thicknessRem ap . y ) ;
m_Profiles [ i ] . UpdateKernelAndVarianceData ( ) ;
}
{
m_ThicknessM aps [ 2 * i ] = m_Profiles [ i ] . thicknessM ap . x ;
m_ThicknessM aps [ 2 * i + 1 ] = m_Profiles [ i ] . thicknessM ap . y - m_Profiles [ i ] . thicknessM ap . x ;
m_ThicknessRem aps [ 2 * i ] = m_Profiles [ i ] . thicknessRem ap . x ;
m_ThicknessRem aps [ 2 * i + 1 ] = m_Profiles [ i ] . thicknessRem ap . y - m_Profiles [ i ] . thicknessRem ap . x ;
m_HalfRcpWeightedVariances [ i ] = m_Profiles [ i ] . halfRcpWeightedVariances ;
m_HalfRcpWeightedVariances [ i ] = m_Profiles [ i ] . halfRcpWeightedVariances ;
for ( int j = 0 , n = SubsurfaceScatteringProfile . numSamples ; j < n ; j + + )
{
public readonly GUIContent profileStdDev2 = new GUIContent ( "Standard deviation #2" , "Determines the shape of the 2nd Gaussian filter. Increases the strength and the radius of the blur of the corresponding color channel." ) ;
public readonly GUIContent profileLerpWeight = new GUIContent ( "Filter interpolation" , "Controls linear interpolation between the two Gaussian filters." ) ;
public readonly GUIContent profileTransmission = new GUIContent ( "Enable transmission" , "Toggles simulation of light passing through thin objects. Depends on the thickness of the material." ) ;
public readonly GUIContent profileThicknessScale = new GUIContent ( "Thickness map" , "Remaps the thickness parameter from [0, 1] to the desired range." ) ;
public readonly GUIContent profileThicknessRemap = new GUIContent ( "Thickness re map" , "Remaps the thickness parameter from [0, 1] to the desired range." ) ;
public readonly GUIStyle centeredMiniBoldLabel = new GUIStyle ( GUI . skin . label ) ;
}
{
EditorGUI . indentLevel + + ;
SerializedProperty profileStdDev1 = profile . FindPropertyRelative ( "stdDev1" ) ;
SerializedProperty profileStdDev2 = profile . FindPropertyRelative ( "stdDev2" ) ;
SerializedProperty profileLerpWeight = profile . FindPropertyRelative ( "lerpWeight" ) ;
SerializedProperty profileTransmission = profile . FindPropertyRelative ( "enableTransmission" ) ;
SerializedProperty profileThicknessM ap = profile . FindPropertyRelative ( "thicknessM ap" ) ;
SerializedProperty profileStdDev1 = profile . FindPropertyRelative ( "stdDev1" ) ;
SerializedProperty profileStdDev2 = profile . FindPropertyRelative ( "stdDev2" ) ;
SerializedProperty profileLerpWeight = profile . FindPropertyRelative ( "lerpWeight" ) ;
SerializedProperty profileTransmission = profile . FindPropertyRelative ( "enableTransmission" ) ;
SerializedProperty profileThicknessRem ap = profile . FindPropertyRelative ( "thicknessRem ap" ) ;
EditorGUILayout . PropertyField ( profileStdDev1 , styles . profileStdDev1 ) ;
EditorGUILayout . PropertyField ( profileStdDev2 , styles . profileStdDev2 ) ;
Vector2 thicknessMap = profileThicknessM ap . vector2Value ;
EditorGUILayout . LabelField ( "Min thickness: " , thicknessM ap . x . ToString ( ) ) ;
EditorGUILayout . LabelField ( "Max thickness: " , thicknessM ap . y . ToString ( ) ) ;
EditorGUILayout . MinMaxSlider ( styles . profileThicknessScale , ref thicknessM ap . x , ref thicknessM ap . y , 0 , 1 0 ) ;
profileThicknessM ap . vector2Value = thicknessM ap ;
Vector2 thicknessRemap = profileThicknessRem ap . vector2Value ;
EditorGUILayout . LabelField ( "Min thickness: " , thicknessRem ap . x . ToString ( ) ) ;
EditorGUILayout . LabelField ( "Max thickness: " , thicknessRem ap . y . ToString ( ) ) ;
EditorGUILayout . MinMaxSlider ( styles . profileThicknessRemap , ref thicknessRem ap . x , ref thicknessRem ap . y , 0 , 1 0 ) ;
profileThicknessRem ap . vector2Value = thicknessRem ap ;
EditorGUILayout . Space ( ) ;
EditorGUILayout . LabelField ( styles . profilePreview0 , styles . centeredMiniBoldLabel ) ;
EditorGUILayout . Space ( ) ;
// Draw the transmittance graph.
m_TransmittanceMaterial . SetColor ( "_StdDev1" , profileStdDev1 . colorValue ) ;
m_TransmittanceMaterial . SetColor ( "_StdDev2" , profileStdDev2 . colorValue ) ;
m_TransmittanceMaterial . SetFloat ( "_LerpWeight" , profileLerpWeight . floatValue ) ;
m_TransmittanceMaterial . SetVector ( "_ThicknessMap" , profileThicknessM ap . vector2Value ) ;
m_TransmittanceMaterial . SetColor ( "_StdDev1" , profileStdDev1 . colorValue ) ;
m_TransmittanceMaterial . SetColor ( "_StdDev2" , profileStdDev2 . colorValue ) ;
m_TransmittanceMaterial . SetFloat ( "_LerpWeight" , profileLerpWeight . floatValue ) ;
m_TransmittanceMaterial . SetVector ( "_ThicknessRemap" , profileThicknessRem ap . vector2Value ) ;
EditorGUI . DrawPreviewTexture ( GUILayoutUtility . GetRect ( 1 6 , 1 6 ) , m_TransmittanceImages [ i ] , m_TransmittanceMaterial , ScaleMode . ScaleToFit , 1 6.0f ) ;
EditorGUILayout . Space ( ) ;