浏览代码

HDRenderPipeline: split class and make it work

/Branch_Batching2
Sebastien Lagarde 8 年前
当前提交
4f0ce374
共有 6 个文件被更改,包括 95 次插入62 次删除
  1. 62
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/AmbientOcclusion.cs
  2. 3
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/Estimation.hlsl
  3. 55
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/ScreenSpaceAmbientOcclusionSettings.cs
  4. 12
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/ScreenSpaceAmbientOcclusionSettings.cs.meta
  5. 13
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/ScreenSpaceAmbientOcclusionSettingsSingleton.cs
  6. 12
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/ScreenSpaceAmbientOcclusionSettingsSingleton.cs.meta

62
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/AmbientOcclusion.cs


using System;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Experimental.PostProcessing;

public class ScreenSpaceAmbientOcclusionSettings : ScriptableObject
{
[Serializable]
public struct Settings
{
bool m_Enable;
[SerializeField]
float m_Intensity;
[SerializeField]
float m_Radius;
[SerializeField]
int m_SampleCount;
[SerializeField]
bool m_Downsampling;
public bool enable { set { m_Enable = value; } get { return m_Enable; } }
public float intensity { set { m_Intensity = value; OnValidate(); } get { return m_Intensity; } }
public float radius { set { m_Radius = value; OnValidate(); } get { return m_Radius; } }
public int sampleCount { set { m_SampleCount = value; OnValidate(); } get { return m_SampleCount; } }
public bool downsampling { set { m_Downsampling = value; } get { return m_Downsampling; } }
void OnValidate()
{
m_Intensity = Mathf.Min(2, Mathf.Max(0, m_Intensity));
m_Radius = Mathf.Max(0, m_Radius);
m_SampleCount = Mathf.Min(1, Mathf.Max(32, m_SampleCount));
}
public static readonly Settings s_Defaultsettings = new Settings
{
m_Enable = false,
m_Intensity = 1.0f,
m_Radius = 0.5f,
m_SampleCount = 8,
m_Downsampling = true
};
}
[SerializeField]
Settings m_Settings = Settings.s_Defaultsettings;
public Settings settings
{
get { return m_Settings; }
set { m_Settings = value; }
}
}
public class ScreenSpaceAmbientOcclusionSettingsSingleton : Singleton<ScreenSpaceAmbientOcclusionSettingsSingleton>
{
private ScreenSpaceAmbientOcclusionSettings settings { get; set; }
public static ScreenSpaceAmbientOcclusionSettings overrideSettings
{
get { return instance.settings; }
set { instance.settings = value; }
}
}
public sealed class ScreenSpaceAmbientOcclusionEffect
{
static class Uniforms

3
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/Estimation.hlsl


ao += a1 / a2;
}
// TODO: Check with Keijiro but ao is inverted here...
ao = 1.0 - ao;
// Apply intensity normalization/amplifier/contrast.
ao = pow(max(0, ao * _Radius * _Intensity / _SampleCount), kContrast);

55
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/ScreenSpaceAmbientOcclusionSettings.cs


using System;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
public class ScreenSpaceAmbientOcclusionSettings : ScriptableObject
{
[Serializable]
public struct Settings
{
[SerializeField]
bool m_Enable;
[SerializeField]
float m_Intensity;
[SerializeField]
float m_Radius;
[SerializeField]
int m_SampleCount;
[SerializeField]
bool m_Downsampling;
public bool enable { set { m_Enable = value; } get { return m_Enable; } }
public float intensity { set { m_Intensity = value; OnValidate(); } get { return m_Intensity; } }
public float radius { set { m_Radius = value; OnValidate(); } get { return m_Radius; } }
public int sampleCount { set { m_SampleCount = value; OnValidate(); } get { return m_SampleCount; } }
public bool downsampling { set { m_Downsampling = value; } get { return m_Downsampling; } }
void OnValidate()
{
m_Intensity = Mathf.Min(2, Mathf.Max(0, m_Intensity));
m_Radius = Mathf.Max(0, m_Radius);
m_SampleCount = Mathf.Min(1, Mathf.Max(32, m_SampleCount));
}
public static readonly Settings s_Defaultsettings = new Settings
{
m_Enable = false,
m_Intensity = 1.0f,
m_Radius = 0.5f,
m_SampleCount = 8,
m_Downsampling = true
};
}
[SerializeField]
Settings m_Settings = Settings.s_Defaultsettings;
public Settings settings
{
get { return m_Settings; }
set { m_Settings = value; }
}
}
}

12
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/ScreenSpaceAmbientOcclusionSettings.cs.meta


fileFormatVersion: 2
guid: d7d48b3fd85781a41844f6983c10d47d
timeCreated: 1496196658
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

13
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/ScreenSpaceAmbientOcclusionSettingsSingleton.cs


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
public class ScreenSpaceAmbientOcclusionSettingsSingleton : Singleton<ScreenSpaceAmbientOcclusionSettingsSingleton>
{
private ScreenSpaceAmbientOcclusionSettings settings { get; set; }
public static ScreenSpaceAmbientOcclusionSettings overrideSettings
{
get { return instance.settings; }
set { instance.settings = value; }
}
}
}

12
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/ScreenSpaceAmbientOcclusionSettingsSingleton.cs.meta


fileFormatVersion: 2
guid: 5da3bcf229fbf3d4ab232413e3a07457
timeCreated: 1496196658
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存