浏览代码

Merge remote-tracking branch 'refs/remotes/origin/master' into 2018.1-experimental

/main
sebastienlagarde 7 年前
当前提交
0b448138
共有 12 个文件被更改,包括 98 次插入30 次删除
  1. 83
      ScriptableRenderPipeline/Core/CoreRP/Textures/BufferedRTHandleSystem.cs
  2. 5
      ScriptableRenderPipeline/HDRenderPipeline/CHANGELOG.md
  3. 8
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDAssetFactory.cs
  4. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/GlobalLightLoopSettings.cs
  5. 11
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.cs
  6. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/HDRenderPipelineResources.asset
  7. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/RenderPipelineResources.cs
  8. 6
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.shader
  9. 8
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/Resources.meta
  10. 0
      /ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.shader.meta
  11. 0
      /ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.shader

83
ScriptableRenderPipeline/Core/CoreRP/Textures/BufferedRTHandleSystem.cs


namespace UnityEngine.Experimental.Rendering
{
/// <summary>
/// Implement a multiple buffering for RenderTextures.
/// </summary>
/// <exemple>
/// <code>
/// enum BufferType
/// {
/// Color,
/// Depth
/// }
///
/// void Render()
/// {
/// var camera = GetCamera();
/// var buffers = GetFrameHistoryBuffersFor(camera);
///
/// // Set reference size in case the rendering size changed this frame
/// buffers.SetReferenceSize(
/// GetCameraWidth(camera), GetCameraHeight(camera),
/// GetCameraUseMSAA(camera), GetCameraMSAASamples(camera)
/// );
/// buffers.Swap();
///
/// var currentColor = buffer.GetFrameRT((int)BufferType.Color, 0);
/// if (currentColor == null) // Buffer was not allocated
/// {
/// buffer.AllocBuffer(
/// (int)BufferType.Color, // Color buffer id
/// ColorBufferAllocator, // Custom functor to implement allocation
/// 2 // Use 2 RT for this buffer for double buffering
/// );
/// currentColor = buffer.GetFrameRT((int)BufferType.Color, 0);
/// }
///
/// var previousColor = buffers.GetFrameRT((int)BufferType.Color, 1);
///
/// // Use previousColor and write into currentColor
/// }
/// </code>
/// </exemple>
public class BufferedRTHandleSystem : IDisposable
{
Dictionary<int, RTHandleSystem.RTHandle[]> m_RTHandles = new Dictionary<int, RTHandleSystem.RTHandle[]>();

public RTHandleSystem.RTHandle GetFrameRT(int id, int index)
/// <summary>
/// Return the frame RT or null.
/// </summary>
/// <param name="bufferId">Defines the buffer to use.</param>
/// <param name="frameIndex"></param>
/// <returns>The frame RT or null when the <paramref name="bufferId"/> was not previously allocated (<see cref="BufferedRTHandleSystem.AllocBuffer(int, Func{RTHandleSystem, int, RTHandleSystem.RTHandle}, int)" />).</returns>
public RTHandleSystem.RTHandle GetFrameRT(int bufferId, int frameIndex)
if (!m_RTHandles.ContainsKey(id))
if (!m_RTHandles.ContainsKey(bufferId))
Assert.IsTrue(index >= 0 && index < m_RTHandles[id].Length);
Assert.IsTrue(frameIndex >= 0 && frameIndex < m_RTHandles[bufferId].Length);
return m_RTHandles[id][index];
return m_RTHandles[bufferId][frameIndex];
/// <summary>
/// Allocate RT handles for a buffer.
/// </summary>
/// <param name="bufferId">The buffer to allocate.</param>
/// <param name="allocator">The functor to use for allocation.</param>
/// <param name="bufferCount">The number of RT handles for this buffer.</param>
int id,
int bufferId,
int bufferSize
int bufferCount
var buffer = new RTHandleSystem.RTHandle[bufferSize];
m_RTHandles.Add(id, buffer);
var buffer = new RTHandleSystem.RTHandle[bufferCount];
m_RTHandles.Add(bufferId, buffer);
// First is autoresized
buffer[0] = allocator(m_RTHandleSystem, 0);

}
}
/// <summary>
/// Set the reference size for this RT Handle System (<see cref="RTHandleSystem.SetReferenceSize(int, int, bool, MSAASamples)"/>)
/// </summary>
/// <param name="width">The width of the RTs of this buffer.</param>
/// <param name="height">The height of the RTs of this buffer.</param>
/// <param name="msaa">Whether this buffer use MSAA.</param>
/// <param name="msaaSamples">Number of MSAA samples for this buffer.</param>
/// <summary>
/// Swap the buffers.
///
/// Take care that if the new current frame needs resizing, it will occurs during the this call.
/// </summary>
public void Swap()
{
foreach (var item in m_RTHandles)

Dispose(true);
}
/// <summary>
/// Deallocate and clear all buffers.
/// </summary>
public void ReleaseAll()
{
foreach (var item in m_RTHandles)

5
ScriptableRenderPipeline/HDRenderPipeline/CHANGELOG.md


- Configure the volumetric lighting code path to be on by default
### Changed, Removals and deprecations
-
- Remove Resource folder of PreIntegratedFGD and add the resource to RenderPipeline Asset
- Default number of planar reflection change from 4 to 2
### Bug fixes
- Fix ConvertPhysicalLightIntensityToLightIntensity() function used when creating light from script to match HDLightEditor behavior

- Screen Space Refraction proxy model uses the proxy of the first environment light (Reflection probe/Planar probe) or the sky
- Moved RTHandle static methods to RTHandles
- Renamed RTHandle to RTHandleSystem.RTHandle
- Move code for PreIntegratedFDG (Lit.shader) into its dedicated folder to be share with other material
- Move code for LTCArea (Lit.shader) into its dedicated folder to be share with other material
### Bug fixes
- Fix fog flags in scene view is now taken into account

8
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDAssetFactory.cs


newAsset.opaqueAtmosphericScattering = Load<Shader>(HDRenderPipelinePath + "Sky/OpaqueAtmosphericScattering.shader");
newAsset.hdriSky = Load<Shader>(HDRenderPipelinePath + "Sky/HDRISky/HDRISky.shader");
newAsset.proceduralSky = Load<Shader>(HDRenderPipelinePath + "Sky/ProceduralSky/ProceduralSky.shader");
// Skybox/Cubemap is a builtin shader, must use Sahder.Find to access it. It is fine because we are in the editor
newAsset.skyboxCubemap = Shader.Find("Skybox/Cubemap");
// Material
newAsset.preIntegratedFGD = Load<Shader>(HDRenderPipelinePath + "Material/PreIntegratedFGD.shader");
// Skybox/Cubemap is a builtin shader, must use Sahder.Find to access it. It is fine because we are in the editor
newAsset.skyboxCubemap = Shader.Find("Skybox/Cubemap");
// Shadow
newAsset.shadowClearShader = Load<Shader>(CorePath + "Shadow/ShadowClear.shader");

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/GlobalLightLoopSettings.cs


public int pointCookieSize = 128;
public int cubeCookieTexArraySize = 16;
public int reflectionProbeCacheSize = 4;
public int reflectionProbeCacheSize = 2;
public int planarReflectionProbeCacheSize = 1024;
public int reflectionCubemapSize = 128;
public int planarReflectionTextureSize = 128;

11
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.cs


int m_refCounting;
// For image based lighting
Material m_InitPreFGD;
Material m_PreIntegratedFGDMaterial;
RenderTexture m_PreIntegratedFGD;
PreIntegratedFGD()

if (m_refCounting == 0)
{
m_InitPreFGD = CoreUtils.CreateEngineMaterial("Hidden/HDRenderPipeline/PreIntegratedFGD");
var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
m_PreIntegratedFGDMaterial = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.preIntegratedFGD);
m_PreIntegratedFGD = new RenderTexture(128, 128, 0, RenderTextureFormat.ARGB2101010, RenderTextureReadWrite.Linear);
m_PreIntegratedFGD.hideFlags = HideFlags.HideAndDontSave;

if (m_isInit)
return;
using (new ProfilingSample(cmd, "Init PreFGD"))
using (new ProfilingSample(cmd, "PreIntegratedFGD Material Generation"))
CoreUtils.DrawFullScreen(cmd, m_InitPreFGD, new RenderTargetIdentifier(m_PreIntegratedFGD));
CoreUtils.DrawFullScreen(cmd, m_PreIntegratedFGDMaterial, new RenderTargetIdentifier(m_PreIntegratedFGD));
}
m_isInit = true;

if (m_refCounting == 0)
{
CoreUtils.Destroy(m_InitPreFGD);
CoreUtils.Destroy(m_PreIntegratedFGDMaterial);
CoreUtils.Destroy(m_PreIntegratedFGD);
m_isInit = false;

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/HDRenderPipelineResources.asset


hdriSky: {fileID: 4800000, guid: 9bd32a6ece529fd4f9408b8d7e00c10d, type: 3}
proceduralSky: {fileID: 4800000, guid: ec63f47fd265df243a7b1d40f9ef7fe7, type: 3}
skyboxCubemap: {fileID: 103, guid: 0000000000000000f000000000000000, type: 0}
preIntegratedFGD: {fileID: 4800000, guid: 123f13d52852ef547b2962de4bd9eaad, type: 3}
encodeBC6HCS: {fileID: 7200000, guid: aa922d239de60304f964e24488559eeb, type: 3}
cubeToPanoShader: {fileID: 4800000, guid: 595434cc3b6405246b6cd3086d0b6f7d, type: 3}
blitCubeTextureFace: {fileID: 4800000, guid: d850d0a2481878d4bbf17e5126b04163, type: 3}

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/RenderPipelineResources.cs


public Shader opaqueAtmosphericScattering;
public Shader hdriSky;
public Shader proceduralSky;
// Material
public Shader preIntegratedFGD;
// Utilities / Core
public ComputeShader encodeBC6HCS;

6
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.shader


Shader "Hidden/HDRenderPipeline/PreIntegratedFGD"
{
SubShader
SubShader
Pass
Pass
{
ZTest Always Cull Off ZWrite Off

#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/ImageBasedLighting.hlsl"
#include "../../../ShaderVariables.hlsl"
#include "../../ShaderVariables.hlsl"
struct Attributes
{

8
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/Resources.meta


fileFormatVersion: 2
guid: ce581725fe970e14abbd599942a16779
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

/ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/Resources/PreIntegratedFGD.shader.meta → /ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.shader.meta

/ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/Resources/PreIntegratedFGD.shader → /ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.shader

正在加载...
取消
保存