Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion com.unity.render-pipelines.core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "SRP Core makes it easier to create or customize a Scriptable Render Pipeline (SRP). SRP Core contains reusable code, including boilerplate code for working with platform-specific graphics APIs, utility functions for common rendering operations, and shader libraries. The code in SRP Core is use by the High Definition Render Pipeline (HDRP) and Universal Render Pipeline (URP). If you are creating a custom SRP from scratch or customizing a prebuilt SRP, using SRP Core will save you time.",
"version": "12.0.0",
"unity": "2021.2",
"unityRelease": "0a19",
"unityRelease": "0a21",
"displayName": "Core RP Library",
"dependencies": {
"com.unity.ugui": "1.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Configuration files for the High Definition Render Pipeline.",
"version": "12.0.0",
"unity": "2021.2",
"unityRelease": "0a19",
"unityRelease": "0a21",
"displayName": "High Definition RP Config",
"dependencies": {
"com.unity.render-pipelines.core": "12.0.0"
Expand Down
2 changes: 1 addition & 1 deletion com.unity.render-pipelines.high-definition/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "The High Definition Render Pipeline (HDRP) is a high-fidelity Scriptable Render Pipeline built by Unity to target modern (Compute Shader compatible) platforms. HDRP utilizes Physically-Based Lighting techniques, linear lighting, HDR lighting, and a configurable hybrid Tile/Cluster deferred/Forward lighting architecture and gives you the tools you need to create games, technical demos, animations, and more to a high graphical standard.",
"version": "12.0.0",
"unity": "2021.2",
"unityRelease": "0a19",
"unityRelease": "0a21",
"displayName": "High Definition RP",
"dependencies": {
"com.unity.modules.video": "1.0.0",
Expand Down
1 change: 1 addition & 0 deletions com.unity.render-pipelines.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added Lights 2D to the Light Explorer window.
- Two new URP specific scene templates, Basic which has a camera and directional light, then Standard which has the addition of a global volume with basic post effects setup.
- Added Render Settings Converter to the Render Pipeline Converter, this tool creates and assigns URP Assets based off rendering settings of a Builtin project.
- XR: Added Late Latching support to reduce VR latency (Quest).

### Changed
- Moved fog evaluation from vertex shader to pixel shader. This improves rendering of fog for big triangles and fog quality. This can change the look of the fog slightly.
Expand Down
12 changes: 12 additions & 0 deletions com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,11 @@ public void Execute(ScriptableRenderContext context, ref RenderingData rendering
ExecuteBlock(RenderPassBlock.MainRenderingTransparent, in renderBlocks, context, ref renderingData);
}

#if ENABLE_VR && ENABLE_XR_MODULE
if (cameraData.xr.enabled)
cameraData.xr.canMarkLateLatch = false;
#endif

// Draw Gizmos...
if (drawGizmos)
{
Expand Down Expand Up @@ -963,6 +968,11 @@ void ExecuteRenderPass(ScriptableRenderContext context, ScriptableRenderPass ren
ExecuteNativeRenderPass(context, renderPass, cameraData, ref renderingData);
else
renderPass.Execute(context, ref renderingData);

#if ENABLE_VR && ENABLE_XR_MODULE
if (cameraData.xr.enabled && cameraData.xr.hasMarkedLateLatch)
cameraData.xr.UnmarkLateLatchShaderProperties(cmd, ref cameraData);
#endif
}

void SetRenderPassAttachments(CommandBuffer cmd, ScriptableRenderPass renderPass, ref CameraData cameraData)
Expand Down Expand Up @@ -1199,6 +1209,8 @@ void BeginXRRendering(CommandBuffer cmd, ScriptableRenderContext context, ref Ca
#if ENABLE_VR && ENABLE_XR_MODULE
if (cameraData.xr.enabled)
{
if (cameraData.xr.isLateLatchEnabled)
cameraData.xr.canMarkLateLatch = true;
cameraData.xr.StartSinglePass(cmd);
cmd.EnableShaderKeyword(ShaderKeywordStrings.UseDrawProcedural);
context.ExecuteCommandBuffer(cmd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,8 @@ static void RenderCameraStack(ScriptableRenderContext context, Camera baseCamera

// Helper function for updating cameraData with xrPass Data
m_XRSystem.UpdateCameraData(ref baseCameraData, baseCameraData.xr);

m_XRSystem.BeginLateLatching(baseCamera, xrPass);
}
#endif

Expand All @@ -560,6 +562,10 @@ static void RenderCameraStack(ScriptableRenderContext context, Camera baseCamera
EndCameraRendering(context, baseCamera);
}

#if ENABLE_VR && ENABLE_XR_MODULE
m_XRSystem.EndLateLatching(baseCamera, xrPass);
#endif

if (isStackedRendering)
{
for (int i = 0; i < cameraStack.Count; ++i)
Expand Down
29 changes: 29 additions & 0 deletions com.unity.render-pipelines.universal/Runtime/XR/XRPass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ class XRPass
static RenderTargetIdentifier invalidRT = -1;
internal bool renderTargetValid { get => renderTarget != invalidRT; }
internal bool renderTargetIsRenderTexture { get; private set; }
internal bool isLateLatchEnabled { get; set; }
internal bool canMarkLateLatch { get; set; }
internal bool hasMarkedLateLatch { get; set; }

// Access to view information
internal Matrix4x4 GetProjMatrix(int viewIndex = 0) { return views[viewIndex].projMatrix; }
Expand Down Expand Up @@ -452,8 +455,34 @@ internal void UpdateGPUViewAndProjectionMatrices(CommandBuffer cmd, ref CameraDa
stereoProjectionMatrix[i] = GL.GetGPUProjectionMatrix(stereoCameraProjectionMatrix[i], isRenderToTexture);
}
RenderingUtils.SetStereoViewAndProjectionMatrices(cmd, stereoViewMatrix, stereoProjectionMatrix, stereoCameraProjectionMatrix, true);
if (cameraData.xr.canMarkLateLatch)
MarkLateLatchShaderProperties(cmd, ref cameraData);
}
}

internal static readonly int UNITY_STEREO_MATRIX_V = Shader.PropertyToID("unity_StereoMatrixV");
internal static readonly int UNITY_STEREO_MATRIX_IV = Shader.PropertyToID("unity_StereoMatrixInvV");
internal static readonly int UNITY_STEREO_MATRIX_VP = Shader.PropertyToID("unity_StereoMatrixVP");
internal static readonly int UNITY_STEREO_MATRIX_IVP = Shader.PropertyToID("unity_StereoMatrixIVP");

internal void MarkLateLatchShaderProperties(CommandBuffer cmd, ref CameraData cameraData)
{
cmd.MarkLateLatchMatrixShaderPropertyID(CameraLateLatchMatrixType.View, UNITY_STEREO_MATRIX_V);
cmd.MarkLateLatchMatrixShaderPropertyID(CameraLateLatchMatrixType.InverseView, UNITY_STEREO_MATRIX_IV);
cmd.MarkLateLatchMatrixShaderPropertyID(CameraLateLatchMatrixType.ViewProjection, UNITY_STEREO_MATRIX_VP);
cmd.MarkLateLatchMatrixShaderPropertyID(CameraLateLatchMatrixType.InverseViewProjection, UNITY_STEREO_MATRIX_IVP);
cmd.SetLateLatchProjectionMatrices(stereoProjectionMatrix);
cameraData.xr.hasMarkedLateLatch = true;
}

internal void UnmarkLateLatchShaderProperties(CommandBuffer cmd, ref CameraData cameraData)
{
cmd.UnmarkLateLatchMatrix(CameraLateLatchMatrixType.View);
cmd.UnmarkLateLatchMatrix(CameraLateLatchMatrixType.InverseView);
cmd.UnmarkLateLatchMatrix(CameraLateLatchMatrixType.ViewProjection);
cmd.UnmarkLateLatchMatrix(CameraLateLatchMatrixType.InverseViewProjection);
cameraData.xr.hasMarkedLateLatch = false;
}
}
}

Expand Down
19 changes: 19 additions & 0 deletions com.unity.render-pipelines.universal/Runtime/XR/XRSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,25 @@ internal int GetMaxViews()
return maxViews;
}

internal void BeginLateLatching(Camera camera, XRPass xrPass)
{
//Only support late latching for multiview use case
if (display != null && xrPass.singlePassEnabled && xrPass.viewCount == 2)
{
display.BeginRecordingIfLateLatched(camera);
xrPass.isLateLatchEnabled = true;
}
}

internal void EndLateLatching(Camera camera, XRPass xrPass)
{
if (display != null && xrPass.isLateLatchEnabled)
{
display.EndRecordingIfLateLatched(camera);
xrPass.isLateLatchEnabled = false;
}
}

internal List<XRPass> SetupFrame(Camera camera, bool enableXRRendering)
{
bool xrEnabled = RefreshXrSdk();
Expand Down
2 changes: 1 addition & 1 deletion com.unity.render-pipelines.universal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "The Universal Render Pipeline (URP) is a prebuilt Scriptable Render Pipeline, made by Unity. URP provides artist-friendly workflows that let you quickly and easily create optimized graphics across a range of platforms, from mobile to high-end consoles and PCs.",
"version": "12.0.0",
"unity": "2021.2",
"unityRelease": "0a19",
"unityRelease": "0a21",
"displayName": "Universal RP",
"dependencies": {
"com.unity.mathematics": "1.2.1",
Expand Down
2 changes: 1 addition & 1 deletion com.unity.shadergraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "The Shader Graph package adds a visual Shader editing tool to Unity. You can use this tool to create Shaders in a visual way instead of writing code. Specific render pipelines can implement specific graph features. Currently, both the High Definition Rendering Pipeline and the Universal Rendering Pipeline support Shader Graph.",
"version": "12.0.0",
"unity": "2021.2",
"unityRelease": "0a19",
"unityRelease": "0a21",
"displayName": "Shader Graph",
"dependencies": {
"com.unity.render-pipelines.core": "12.0.0",
Expand Down
2 changes: 1 addition & 1 deletion com.unity.visualeffectgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Visual Effect Graph",
"version": "12.0.0",
"unity": "2021.2",
"unityRelease": "0a19",
"unityRelease": "0a21",
"description": "The Visual Effect Graph is a node based visual effect editor. It allows you to author next generation visual effects that Unity simulates directly on the GPU. The Visual Effect Graph is production-ready for the High Definition Render Pipeline and runs on all platforms supported by it. Full support for the Universal Render Pipeline and compatible mobile devices is still in development.",
"keywords": [
"vfx",
Expand Down