浏览代码

Fix serialization issues

/fptl_cleanup
Evgenii Golubev 8 年前
当前提交
92012aec
共有 7 个文件被更改,包括 95 次插入73 次删除
  1. 1
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Default SSS Profile.asset
  2. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Default SSS Profile.asset.meta
  3. 64
      Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.asset
  4. 6
      Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
  5. 33
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/LitUI.cs
  6. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
  7. 60
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SubsurfaceScatteringProfile.cs

1
Assets/ScriptableRenderPipeline/HDRenderPipeline/Default SSS Profile.asset


lerpWeight: 0.5
enableTransmission: 0
thicknessRemap: {x: 0, y: 1}
settingsIndex: 0
m_FilterKernel:
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.7609476}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.49358216}

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Default SSS Profile.asset.meta


fileFormatVersion: 2
guid: 09521380d86baee43bf09b32473ea5f3
timeCreated: 1490017303
timeCreated: 1490111978
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 11400000

64
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.asset


type: 2}
globalDebugSettings:
debugOverlayRatio: 0.33
displayMaterialDebug: 0
displayRenderingDebug: 0
displayMaterialDebug: 1
displayRenderingDebug: 1
displayLightingDebug: 0
materialDebugSettings:
debugViewMaterial: 0

- 0
- 1
- 0
- 3
- 0
- 1
- 1
- 0
- 0
- 0

- 0
- 0
halfRcpVariancesAndLerpWeights:
- {x: 5.5555553, y: 5.5555553, z: 5.5555553, w: 0.5}
- {x: 1.3888888, y: 1.3888888, z: 1.3888888, w: 0.5}
- {x: 5.5555553, y: 5.5555553, z: 5.5555553, w: 0}
- {x: 1.3888888, y: 1.3888888, z: 1.3888888, w: 1}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 5.5555553, y: 5.5555553, z: 5.5555553, w: 0}
- {x: 1.3888888, y: 1.3888888, z: 1.3888888, w: 1}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}

- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
halfRcpWeightedVariances:
- {x: 2.4691355, y: 2.4691355, z: 2.4691355, w: 2.4691355}
- {x: 1.3888888, y: 1.3888888, z: 1.3888888, w: 1.3888888}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 1.3888888, y: 1.3888888, z: 1.3888888, w: 1.3888888}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}

- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.7609476}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.49358216}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.33642715}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.21256521}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.10326859}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.000000048879357}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.10326859}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.21256521}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.33642715}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.4935822}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.7609475}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -1.0145968}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.65810955}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.44856954}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.2834203}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.13769145}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.00000006517248}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.13769145}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.2834203}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.44856954}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.6581096}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 1.0145967}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.7609476}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.49358216}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.33642715}

- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.33642715}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.4935822}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.7609475}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -1.0145968}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.65810955}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.44856954}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.2834203}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.13769145}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: -0.00000006517248}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.13769145}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.2834203}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.44856954}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 0.6581096}
- {x: 0.09090909, y: 0.09090909, z: 0.09090909, w: 1.0145967}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}
- {x: 0, y: 0, z: 0, w: 0}

6
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


{
if (m_SssSettings == null)
{
m_SssSettings = SubsurfaceScatteringSettings.instance;
m_SssSettings = new SubsurfaceScatteringSettings();
}
return m_SssSettings;
}

get { return m_Owner.globalDebugSettings; }
}
public SubsurfaceScatteringSettings sssSettings
{
get { return m_Owner.sssSettings; }
}
public HDRenderPipelineInstance(HDRenderPipeline owner)
{
m_Owner = owner;

33
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/LitUI.cs


using System;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEditor.Experimental.Rendering.HDPipeline

protected MaterialProperty detailSmoothnessScale = null;
protected const string kDetailSmoothnessScale = "_DetailSmoothnessScale";
protected MaterialProperty subsurfaceProfile = null;
protected const string kSubsurfaceProfile = "_SubsurfaceProfile";
protected SubsurfaceScatteringProfile subsurfaceProfile = null;
protected MaterialProperty subsurfaceProfileID = null;
protected const string kSubsurfaceProfileID = "_SubsurfaceProfile";
protected MaterialProperty subsurfaceRadius = null;
protected const string kSubsurfaceRadius = "_SubsurfaceRadius";
protected MaterialProperty subsurfaceRadiusMap = null;

detailSmoothnessScale = FindProperty(kDetailSmoothnessScale, props);
// Sub surface
subsurfaceProfile = FindProperty(kSubsurfaceProfile, props);
subsurfaceProfileID = FindProperty(kSubsurfaceProfileID, props);
subsurfaceRadius = FindProperty(kSubsurfaceRadius, props);
subsurfaceRadiusMap = FindProperty(kSubsurfaceRadiusMap, props);
thickness = FindProperty(kThickness, props);

protected void ShaderSSSInputGUI()
{
m_MaterialEditor.ShaderProperty(subsurfaceProfile, Styles.subsurfaceProfileText);
if (subsurfaceProfile == null)
{
int profileID = (int)subsurfaceProfileID.floatValue;
HDRenderPipelineInstance hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipelineInstance;
if (profileID >= 0 && profileID < hdPipeline.sssSettings.profiles.Length)
{
// This is a valid profile ID.
subsurfaceProfile = hdPipeline.sssSettings.profiles[profileID];
}
else
{
subsurfaceProfile = SubsurfaceScatteringProfile.defaultProfile;
}
// Refresh the ID of the profile.
hdPipeline.sssSettings.OnValidate();
}
// Extract the profile ID.
subsurfaceProfile = EditorGUILayout.ObjectField(Styles.subsurfaceProfileText, subsurfaceProfile, subsurfaceProfile.GetType(), false, null) as SubsurfaceScatteringProfile;
subsurfaceProfileID.floatValue = subsurfaceProfile.settingsIndex;
m_MaterialEditor.ShaderProperty(subsurfaceRadius, Styles.subsurfaceRadiusText);
m_MaterialEditor.TexturePropertySingleLine(Styles.subsurfaceRadiusMapText, subsurfaceRadiusMap);
m_MaterialEditor.ShaderProperty(thickness, Styles.thicknessText);

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader


_Anisotropy("Anisotropy", Range(0.0, 1.0)) = 0
_AnisotropyMap("AnisotropyMap", 2D) = "white" {}
_SubsurfaceProfile("Subsurface Profile", Int) = 0
_SubsurfaceProfile("Subsurface Profile", Float) = 0
_SubsurfaceRadius("Subsurface Radius", Range(0.004, 1.0)) = 1.0
_SubsurfaceRadiusMap("Subsurface Radius Map", 2D) = "white" {}
_Thickness("Thickness", Range(0.004, 1.0)) = 1.0

60
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SubsurfaceScatteringProfile.cs


[SerializeField]
public Vector2 thicknessRemap;
[SerializeField] [HideInInspector]
public int settingsIndex;
[SerializeField] [HideInInspector]
Vector4[] m_FilterKernel;
[SerializeField] [HideInInspector]
Vector3[] m_HalfRcpVariances;

private static SubsurfaceScatteringProfile s_DefaultProfile = null; // Singleton
public static SubsurfaceScatteringProfile defaultProfile
{
get
{
if (s_DefaultProfile == null)
{
s_DefaultProfile = CreateInstance<SubsurfaceScatteringProfile>();
AssetDatabase.CreateAsset(s_DefaultProfile, "Assets/ScriptableRenderPipeline/HDRenderPipeline/Default SSS Profile.asset");
AssetDatabase.SaveAssets();
}
return s_DefaultProfile;
}
}
public SubsurfaceScatteringProfile()
{
stdDev1 = new Color(0.3f, 0.3f, 0.3f, 0.0f);

thicknessRemap = new Vector2(0, 1);
settingsIndex = 0;
UpdateKernelAndVarianceData();
}

public Vector4[] halfRcpWeightedVariances;
public Vector4[] filterKernels;
private static SubsurfaceScatteringSettings s_Instance = null; // Singleton
private static SubsurfaceScatteringProfile s_DefaultProfile = null;
public static SubsurfaceScatteringSettings instance
{
get
{
if (s_Instance == null)
{
s_Instance = new SubsurfaceScatteringSettings();
s_Instance.CreateProfiles();
}
return s_Instance;
}
}
public SubsurfaceScatteringSettings()
{
numProfiles = 1;

if (profiles[i] == null)
{
// No invalid/empty assets allowed!
profiles[i] = defaultProfile;
profiles[i] = SubsurfaceScatteringProfile.defaultProfile;
// Assign profile IDs.
profiles[i].settingsIndex = i;
}
texturingMode = (TexturingMode)Math.Max(0, Math.Min((int)texturingMode, (int)TexturingMode.MaxValue));

// --- Private Methods ---
private static SubsurfaceScatteringProfile defaultProfile
{
get
{
if (s_DefaultProfile == null)
{
s_DefaultProfile = ScriptableObject.CreateInstance<SubsurfaceScatteringProfile>();
AssetDatabase.CreateAsset(s_DefaultProfile, "Assets/ScriptableRenderPipeline/HDRenderPipeline/Default SSS Profile.asset");
AssetDatabase.SaveAssets();
}
return s_DefaultProfile;
}
}
// Limitation of Unity - cannot create assets in the constructor.
public void CreateProfiles()
{

{
profiles[i] = defaultProfile;
profiles[i] = SubsurfaceScatteringProfile.defaultProfile;
}
}
}

if (EditorGUI.EndChangeCheck())
{
// Validate each individual asset and update caches.
SubsurfaceScatteringSettings.instance.OnValidate();
HDRenderPipelineInstance hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipelineInstance;
hdPipeline.sssSettings.OnValidate();
}
}
}
正在加载...
取消
保存