浏览代码

Merge pull request #312 from Unity-Technologies/Add-AdditionalCameraData

HDRenderPipeline: Add AdditionalCameraData to have choice of rendering path
/RenderPassXR_Sandbox
GitHub 8 年前
当前提交
4ffb93c9
共有 6 个文件被更改,包括 74 次插入7 次删除
  1. 19
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs
  2. 27
      Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
  3. 10
      Assets/ScriptableRenderPipeline/HDRenderPipeline/AdditionalData.meta
  4. 12
      Assets/ScriptableRenderPipeline/HDRenderPipeline/AdditionalData/HDAdditionalCameraData.cs
  5. 13
      Assets/ScriptableRenderPipeline/HDRenderPipeline/AdditionalData/HDAdditionalCameraData.cs.meta

19
Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs


}
}
// This script is a helper for the artists to re-synchronise all layered materials
[UnityEditor.MenuItem("HDRenderPipeline/Add \"Additional Camera Data\" (if not present)")]
static void AddAdditionalCameraData()
{
Camera[] cameras = GameObject.FindObjectsOfType(typeof(Camera)) as Camera[];
foreach (Camera camera in cameras)
{
// Do not add a component if there already is one.
if (camera.GetComponent<HDAdditionalCameraData>() == null)
{
camera.gameObject.AddComponent<HDAdditionalCameraData>();
}
}
}
// This script is a helper for the artists to re-synchronize all layered materials
[MenuItem("HDRenderPipeline/Synchronize all Layered materials")]
static void SynchronizeAllLayeredMaterial()
{

}
}
// Funtion used only to check performance of data with and without tessellation
// Function used only to check performance of data with and without tessellation
[MenuItem("HDRenderPipeline/Test/Remove tessellation materials (not reversible)")]
static void RemoveTessellationMaterials()
{

27
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


m_LastFrameActive = -1;
m_FirstFrame = true;
}
static Dictionary<Camera, HDCamera> m_Cameras = new Dictionary<Camera, HDCamera>();
static List<Camera> m_Cleanup = new List<Camera>(); // Recycled to reduce GC pressure

}
m_LightLoop.UpdateCullingParameters( ref cullingParams );
CullResults.Cull(ref cullingParams, renderContext,ref m_CullResults);
Resize(camera);

// We have to bind the material specific global parameters in this mode
m_MaterialList.ForEach(material => material.Bind());
var additionalCameraData = camera.GetComponent<HDAdditionalCameraData>();
if (additionalCameraData && additionalCameraData.renderingPath == RenderingPathHDRP.Unlit)
{
// TODO: Add another path dedicated to planar reflection / real time cubemap that implement simpler lighting
string passName = "Forward"; // It is up to the users to only send unlit object for this camera path
using (new Utilities.ProfilingSample(passName, renderContext))
{
Utilities.SetRenderTarget(renderContext, m_CameraColorBufferRT, m_CameraDepthStencilBufferRT, ClearFlag.ClearColor | ClearFlag.ClearDepth);
RenderOpaqueRenderList(m_CullResults, camera, renderContext, passName);
RenderTransparentRenderList(m_CullResults, camera, renderContext, passName);
}
renderContext.Submit();
return;
}
InitAndClearBuffer(camera, renderContext);
PushGlobalParams(hdCamera, renderContext, m_Asset.sssSettings);

cmd.Blit(BuiltinRenderTextureType.None, m_VelocityBufferRT, m_CameraMotionVectorsMaterial, 0);
cmd.SetRenderTarget(m_VelocityBufferRT, m_CameraDepthStencilBufferRT);
renderContext.ExecuteCommandBuffer(cmd);
RenderOpaqueRenderList(cullResults, hdcam.camera, renderContext, "MotionVectors", RendererConfiguration.PerObjectMotionVectors);
}
}

float overlayRatio = m_DebugDisplaySettings.debugOverlayRatio;
float overlaySize = Math.Min(camera.camera.pixelHeight, camera.camera.pixelWidth) * overlayRatio;
float y = camera.camera.pixelHeight - overlaySize;
LightingDebugSettings lightingDebug = m_DebugDisplaySettings.lightingDebugSettings;
if (lightingDebug.displaySkyReflection)

renderContext.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
Utilities.SetRenderTarget(renderContext, m_CameraColorBufferRT, m_CameraDepthStencilBufferRT, ClearFlag.ClearDepth);
}

10
Assets/ScriptableRenderPipeline/HDRenderPipeline/AdditionalData.meta


fileFormatVersion: 2
guid: 969f45cd0fa680646a77e82d620ba21d
folderAsset: yes
timeCreated: 1498051186
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

12
Assets/ScriptableRenderPipeline/HDRenderPipeline/AdditionalData/HDAdditionalCameraData.cs


namespace UnityEngine.Experimental.Rendering
{
// This struct allow to add specialized path in HDRenderPipeline (can be use to render mini map or planar reflection etc...)
public enum RenderingPathHDRP { Default, Unlit };
[DisallowMultipleComponent, ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class HDAdditionalCameraData : MonoBehaviour
{
public RenderingPathHDRP renderingPath;
}
}

13
Assets/ScriptableRenderPipeline/HDRenderPipeline/AdditionalData/HDAdditionalCameraData.cs.meta


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