浏览代码
HDRenderPipeline: Rename HDRenderPipeline to HDRenderPipelineAsset and split in dedicated file
HDRenderPipeline: Rename HDRenderPipeline to HDRenderPipelineAsset and split in dedicated file
- Rename HDRenderPipeline to HDRenderPipelineAsset - Move new renamed class in its own file - Rename HDRenderPipelineInstance to HDRenderPipeline/RenderPassXR_Sandbox
sebastienlagarde
8 年前
当前提交
6d899dd0
共有 13 个文件被更改,包括 324 次插入 和 321 次删除
-
18Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs
-
262Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/LitUI.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SubsurfaceScatteringProfile.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SceneSettings.cs
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Utilities.cs
-
44Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.asset
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.asset.meta
-
216Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.cs
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.cs.meta
-
51Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.asset
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.asset.meta
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 0cf1dab834d4ec34195b920ea7bbf9ec, type: 3} |
|||
m_Name: HDRenderPipelineAsset |
|||
m_EditorClassIdentifier: |
|||
m_LightLoopProducer: {fileID: 11400000, guid: bf8cd9ae03ff7d54c89603e67be0bfc5, |
|||
type: 2} |
|||
renderingSettings: |
|||
useForwardRenderingOnly: 0 |
|||
useDepthPrepass: 0 |
|||
sssSettings: |
|||
numProfiles: 1 |
|||
profiles: |
|||
- {fileID: 0} |
|||
m_ShadowSettings: |
|||
enabled: 1 |
|||
shadowAtlasWidth: 4096 |
|||
shadowAtlasHeight: 4096 |
|||
maxShadowDistance: 1000 |
|||
directionalLightCascadeCount: 4 |
|||
directionalLightCascades: {x: 0.05, y: 0.2, z: 0.3} |
|||
directionalLightNearPlaneOffset: 5 |
|||
m_TextureSettings: |
|||
spotCookieSize: 128 |
|||
pointCookieSize: 512 |
|||
reflectionCubemapSize: 128 |
|||
m_CommonSettings: |
|||
m_ShadowMaxDistance: 1000 |
|||
m_ShadowCascadeCount: 4 |
|||
m_ShadowCascadeSplit0: 0.05 |
|||
m_ShadowCascadeSplit1: 0.2 |
|||
m_ShadowCascadeSplit2: 0.3 |
|||
m_ShadowNearPlaneOffset: 5 |
|||
m_SkySettings: {fileID: 0} |
|||
m_DefaultDiffuseMaterial: {fileID: 0} |
|||
m_DefaultShader: {fileID: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: fa7ff29edd844404fb648e3eb1134f14 |
|||
timeCreated: 1496140270 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Rendering; |
|||
using System; |
|||
using System.Linq; |
|||
using UnityEngine.Experimental.PostProcessing; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline.TilePass; |
|||
|
|||
#if UNITY_EDITOR
|
|||
using UnityEditor; |
|||
#endif
|
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
// This HDRenderPipeline assume linear lighting. Don't work with gamma.
|
|||
public class HDRenderPipelineAsset : RenderPipelineAsset |
|||
{ |
|||
#if UNITY_EDITOR
|
|||
const string k_HDRenderPipelinePath = "Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.asset"; |
|||
|
|||
[MenuItem("RenderPipeline/HDRenderPipeline/Create Pipeline Asset")] |
|||
static void CreateHDRenderPipeline() |
|||
{ |
|||
var instance = CreateInstance<HDRenderPipelineAsset>(); |
|||
AssetDatabase.CreateAsset(instance, k_HDRenderPipelinePath); |
|||
} |
|||
|
|||
[UnityEditor.MenuItem("HDRenderPipeline/Add \"Additional Light Data\" (if not present)")] |
|||
static void AddAdditionalLightData() |
|||
{ |
|||
Light[] lights = FindObjectsOfType(typeof(Light)) as Light[]; |
|||
|
|||
foreach (Light light in lights) |
|||
{ |
|||
// Do not add a component if there already is one.
|
|||
if (light.GetComponent<AdditionalLightData>() == null) |
|||
{ |
|||
light.gameObject.AddComponent<AdditionalLightData>(); |
|||
} |
|||
} |
|||
} |
|||
#endif
|
|||
|
|||
private HDRenderPipelineAsset() |
|||
{ } |
|||
|
|||
protected override IRenderPipeline InternalCreatePipeline() |
|||
{ |
|||
return new HDRenderPipeline(this); |
|||
} |
|||
|
|||
[SerializeField] |
|||
private LightLoopProducer m_LightLoopProducer; |
|||
public LightLoopProducer lightLoopProducer |
|||
{ |
|||
get { return m_LightLoopProducer; } |
|||
set { m_LightLoopProducer = value; } |
|||
} |
|||
|
|||
// NOTE:
|
|||
// All those properties are public because of how HDRenderPipelineInspector retrieve those properties via serialization/reflection
|
|||
// Those that are not will be refactored later.
|
|||
|
|||
// Debugging
|
|||
public DebugDisplaySettings debugDisplaySettings = new DebugDisplaySettings(); |
|||
|
|||
// Renderer Settings (per project)
|
|||
public RenderingSettings renderingSettings = new RenderingSettings(); |
|||
public SubsurfaceScatteringSettings sssSettings = new SubsurfaceScatteringSettings(); |
|||
|
|||
[SerializeField] |
|||
ShadowSettings m_ShadowSettings = ShadowSettings.Default; |
|||
[SerializeField] |
|||
TextureSettings m_TextureSettings = TextureSettings.Default; |
|||
|
|||
public ShadowSettings shadowSettings |
|||
{ |
|||
get { return m_ShadowSettings; } |
|||
} |
|||
|
|||
public TextureSettings textureSettings |
|||
{ |
|||
get { return m_TextureSettings; } |
|||
set { m_TextureSettings = value; } |
|||
} |
|||
|
|||
// Renderer Settings (per "scene")
|
|||
[SerializeField] |
|||
private CommonSettings.Settings m_CommonSettings = CommonSettings.Settings.s_Defaultsettings; |
|||
[SerializeField] |
|||
private SkySettings m_SkySettings; |
|||
|
|||
public CommonSettings.Settings commonSettingsToUse |
|||
{ |
|||
get |
|||
{ |
|||
if (CommonSettingsSingleton.overrideSettings) |
|||
return CommonSettingsSingleton.overrideSettings.settings; |
|||
|
|||
return m_CommonSettings; |
|||
} |
|||
} |
|||
|
|||
public SkySettings skySettings |
|||
{ |
|||
get { return m_SkySettings; } |
|||
set { m_SkySettings = value; } |
|||
} |
|||
|
|||
public SkySettings skySettingsToUse |
|||
{ |
|||
get |
|||
{ |
|||
if (SkySettingsSingleton.overrideSettings) |
|||
return SkySettingsSingleton.overrideSettings; |
|||
|
|||
return m_SkySettings; |
|||
} |
|||
} |
|||
|
|||
[SerializeField] |
|||
private Material m_DefaultDiffuseMaterial; |
|||
[SerializeField] |
|||
private Shader m_DefaultShader; |
|||
|
|||
public Material DefaultDiffuseMaterial |
|||
{ |
|||
get { return m_DefaultDiffuseMaterial; } |
|||
private set { m_DefaultDiffuseMaterial = value; } |
|||
} |
|||
|
|||
public Shader DefaultShader |
|||
{ |
|||
get { return m_DefaultShader; } |
|||
private set { m_DefaultShader = value; } |
|||
} |
|||
|
|||
public override Shader GetDefaultShader() |
|||
{ |
|||
return m_DefaultShader; |
|||
} |
|||
|
|||
public override Material GetDefaultMaterial() |
|||
{ |
|||
return m_DefaultDiffuseMaterial; |
|||
} |
|||
|
|||
public override Material GetDefaultParticleMaterial() |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
public override Material GetDefaultLineMaterial() |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
public override Material GetDefaultTerrainMaterial() |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
public override Material GetDefaultUIMaterial() |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
public override Material GetDefaultUIOverdrawMaterial() |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
public override Material GetDefaultUIETC1SupportedMaterial() |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
public override Material GetDefault2DMaterial() |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
public void ApplyDebugDisplaySettings() |
|||
{ |
|||
m_ShadowSettings.enabled = debugDisplaySettings.lightingDebugSettings.enableShadows; |
|||
|
|||
LightingDebugSettings lightingDebugSettings = debugDisplaySettings.lightingDebugSettings; |
|||
Vector4 debugAlbedo = new Vector4(lightingDebugSettings.debugLightingAlbedo.r, lightingDebugSettings.debugLightingAlbedo.g, lightingDebugSettings.debugLightingAlbedo.b, 0.0f); |
|||
Vector4 debugSmoothness = new Vector4(lightingDebugSettings.overrideSmoothness ? 1.0f : 0.0f, lightingDebugSettings.overrideSmoothnessValue, 0.0f, 0.0f); |
|||
|
|||
Shader.SetGlobalInt("_DebugViewMaterial", (int)debugDisplaySettings.GetDebugMaterialIndex()); |
|||
Shader.SetGlobalInt("_DebugLightingMode", (int)debugDisplaySettings.GetDebugLightingMode()); |
|||
Shader.SetGlobalVector("_DebugLightingAlbedo", debugAlbedo); |
|||
Shader.SetGlobalVector("_DebugLightingSmoothness", debugSmoothness); |
|||
} |
|||
|
|||
public void UpdateCommonSettings() |
|||
{ |
|||
var commonSettings = commonSettingsToUse; |
|||
|
|||
m_ShadowSettings.directionalLightCascadeCount = commonSettings.shadowCascadeCount; |
|||
m_ShadowSettings.directionalLightCascades = new Vector3(commonSettings.shadowCascadeSplit0, commonSettings.shadowCascadeSplit1, commonSettings.shadowCascadeSplit2); |
|||
m_ShadowSettings.maxShadowDistance = commonSettings.shadowMaxDistance; |
|||
m_ShadowSettings.directionalLightNearPlaneOffset = commonSettings.shadowNearPlaneOffset; |
|||
} |
|||
|
|||
public void OnValidate() |
|||
{ |
|||
debugDisplaySettings.OnValidate(); |
|||
sssSettings.OnValidate(); |
|||
} |
|||
|
|||
void OnEnable() |
|||
{ |
|||
debugDisplaySettings.RegisterDebug(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0cf1dab834d4ec34195b920ea7bbf9ec |
|||
timeCreated: 1496139874 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: f365a473b136bef4797c7281a02cd510, type: 3} |
|||
m_Name: HDRenderPipeline |
|||
m_EditorClassIdentifier: |
|||
m_LightLoopProducer: {fileID: 11400000, guid: bf8cd9ae03ff7d54c89603e67be0bfc5, |
|||
type: 2} |
|||
renderingSettings: |
|||
useForwardRenderingOnly: 0 |
|||
useDepthPrepass: 0 |
|||
sssSettings: |
|||
numProfiles: 7 |
|||
profiles: |
|||
- {fileID: 11400000, guid: d6ee4403015766f4093158d69216c0bf, type: 2} |
|||
- {fileID: 11400000, guid: 906339bac2066fc4aa22a3652e1283ef, type: 2} |
|||
- {fileID: 0} |
|||
- {fileID: 0} |
|||
- {fileID: 0} |
|||
- {fileID: 0} |
|||
- {fileID: 0} |
|||
m_ShadowSettings: |
|||
enabled: 1 |
|||
shadowAtlasWidth: 4096 |
|||
shadowAtlasHeight: 4096 |
|||
maxShadowDistance: 400 |
|||
directionalLightCascadeCount: 4 |
|||
directionalLightCascades: {x: 0.05, y: 0.2, z: 0.3} |
|||
directionalLightNearPlaneOffset: 5 |
|||
m_TextureSettings: |
|||
spotCookieSize: 128 |
|||
pointCookieSize: 512 |
|||
reflectionCubemapSize: 128 |
|||
m_CommonSettings: |
|||
m_ShadowMaxDistance: 1000 |
|||
m_ShadowCascadeCount: 4 |
|||
m_ShadowCascadeSplit0: 0.05 |
|||
m_ShadowCascadeSplit1: 0.2 |
|||
m_ShadowCascadeSplit2: 0.3 |
|||
m_ShadowNearPlaneOffset: 5 |
|||
m_SkySettings: {fileID: 0} |
|||
m_DefaultDiffuseMaterial: {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, |
|||
type: 2} |
|||
m_DefaultShader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3} |
|
|||
fileFormatVersion: 2 |
|||
guid: e185fecca3c73cd47a09f1092663ef32 |
|||
timeCreated: 1487689448 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue