Skip to content

Commit 2cc4b51

Browse files
adrien-de-tocquevilleAntoine LelievresebastienlagardeFrancescoC-unitypmavridis
authored
Project skybox without perspective for ortho cameras (#2955)
* [HDRP] Fix coat normal space (#2888) * Fix coat normal space * Update CHANGELOG.md Co-authored-by: Sebastien Lagarde <[email protected]> * Avoid issues causing faulty transitions in shadows (resulting in no shadows with unconventional aspect ratio) (#2776) * Fixed volume component tooltips using the same parameter name (#2754) * Use the proper history info for Bicubic resampling in TAA (#2759) * Use proper info for previous buffer info * changelog * Fixed lookdev movement (#2757) Co-authored-by: sebastienlagarde <[email protected]> * [HDRP] Fix issue with saving some quality settings in volume overrides (#2758) * Fix issue with saving some quality settings volume overrides * Fix typo in changelog Co-authored-by: sebastienlagarde <[email protected]> * [HDRP] Fixed NullReferenceException in HDRenderPipeline.UpgradeResourcesIfNeeded (case 1292524) (#2765) * fix issue with confusing text (#2766) * Fix * Fix white dots * Changelog * Rename the sunrise icon to fix typo, causing issue with 2x resolution loading. (#2809) * [HDRP] Rename HDRP to HD Render Pipeline in menu item (#2819) * [HDRP] Update HDRP menu in shader graph * Update CHANGELOG.md * HDRP/Fix package version showing package after the last "verified" package (#2783) * Fix typo * Remove last version checker from wizard and add link to package manager instead * Update CHANGELOG.md * Update documentation * Update Render-Pipeline-Wizard.md Co-authored-by: Sebastien Lagarde <[email protected]> * Revert bad changelog merge * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: Adrien de Tocqueville <[email protected]> Co-authored-by: sebastienlagarde <[email protected]> Co-authored-by: Pavlos Mavridis <[email protected]> Co-authored-by: John Parsaie <[email protected]> Co-authored-by: Remi Slysz <[email protected]> * Fixed invalid loop length for probe baking (case 1289680) (#2830) * Fixed invalid loop length for probe baking (case 1289680) # Conflicts: # com.unity.render-pipelines.high-definition/CHANGELOG.md # Conflicts: # com.unity.render-pipelines.high-definition/CHANGELOG.md * Update CHANGELOG.md Co-authored-by: sebastienlagarde <[email protected]> * Fix volumetric fog with XR single-pass (#2823) * fix volumetric fog with XR single-pass rendering * update changelog Co-authored-by: sebastienlagarde <[email protected]> * [HDRP] Fix rendering issues for the first frame (#2836) * Fix first frame exposure, depth pyramid / AO * Update changelog * Comment * Typo * Add missing RenderGraphBuilder.ReadTexture call * Move ComputePackedMipChainInfo at the beginning of ExecuteWithRenderGraph Co-authored-by: sebastienlagarde <[email protected]> * Update 5001_Fog_FogFallback.png * Revert "Update 5001_Fog_FogFallback.png" This reverts commit 2653b9c. * Update 5001_Fog_FogFallback.unity * Fix AOV API for render graph (#2909) * Fix AOV api in rendergraph # Conflicts: # com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs * Update changelog * Fix a small discrepancy in the marker placement in light intensity sliders (#2924) * Update CHANGELOG.md * Fix issue with VT spewing errors when transparent and opaque are disabled (#2925) * Fix * Changelog Co-authored-by: sebastienlagarde <[email protected]> * Fixed a bug in the sphere-aabb light cluster (case 1294767). (#2920) Co-authored-by: sebastienlagarde <[email protected]> * Move EndCameraRendering callback out of the profiling scope (#2917) * Move EndCameraRendering callback out of the profiling scope * added a comment Co-authored-by: sebastienlagarde <[email protected]> * Fixed baked light being included into the ray tracing light cluster (case 1296203). (#2915) Co-authored-by: sebastienlagarde <[email protected]> * Handle all enums the same way for UI (#2913) Co-authored-by: sebastienlagarde <[email protected]> * Changed the message when the graphics device doesn't support ray tracing (case 1287355). (#2916) * [HDRP] Fix default blocks for Hair and Eye shader graphs (#2919) * Fixed default eye shader blocks * Fix missing emission block in hair shader * Updated changelog Co-authored-by: sebastienlagarde <[email protected]> * Init scene camera debug framesettings (#2931) * Fixed using the wrong method to define if a light should be included in the light cluster depending on its baking status. (#2932) * - Fixed using the wrong method to define if a light should be included in the light cluster depending on its baking status. * Update CHANGELOG.md Co-authored-by: sebastienlagarde <[email protected]> * [HDRP] Change the behavior of custom passes when the volume is disabled (#2930) * Changed the behavior of custom passes when the Custom Pass Volume component is disabled * Updated changelog * Fixed display of LOD Bias and maximum level in frame settings when using Quality Levels (#2921) * Fixed display of LOD Bias and maximum level in frame settings when using Quality Levels * Update changelog Co-authored-by: sebastienlagarde <[email protected]> * Fixed an issue when trying to open a look dev env library when Look Dev is not supported. (#2929) * Fixed an issue when trying to open a look dev env library when Look Dev is not supported. * Update changelog Co-authored-by: sebastienlagarde <[email protected]> * Enable Reflector for Spotlight by default * - Fixed shader graph not supporting indirectdxr multibounce (case 1294694). (#2933) Co-authored-by: sebastienlagarde <[email protected]> * Fixed the planar depth texture not being properly created and rendered to (case 1299617). (#2926) * Fixed the planar depth texture not being properly created and rendered to (case 1299617). * adding comment Co-authored-by: sebastienlagarde <[email protected]> * Fixed C# 8 compilation issue with turning on nullable checks (case 1300167) (#2949) * Fixed C# 8 compilation issue with turning on nullable checks - bis (#2951) * Fixed C# 8 compilation issue with turning on nullable checks (case 1300167) * Update MaterialDebug.cs * Fix scripting light test with enableReflector true by default * Project skybox without perspective for ortho cameras * Explicit orthographic argument Co-authored-by: Antoine Lelievre <[email protected]> Co-authored-by: Sebastien Lagarde <[email protected]> Co-authored-by: FrancescoC-unity <[email protected]> Co-authored-by: Pavlos Mavridis <[email protected]> Co-authored-by: John Parsaie <[email protected]> Co-authored-by: Remi Slysz <[email protected]> Co-authored-by: Frédéric Vauchelles <[email protected]> Co-authored-by: Fabien Houlmann <[email protected]> Co-authored-by: anisunity <[email protected]> Co-authored-by: JulienIgnace-Unity <[email protected]>
1 parent b84c14b commit 2cc4b51

File tree

3 files changed

+38
-23
lines changed

3 files changed

+38
-23
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1818
### Changed
1919
- Removed the material pass probe volumes evaluation mode.
2020
- Updated the tooltip for the Decal Angle Fade property (requires to enable Decal Layers in both HDRP asset and Frame settings) (case 1308048).
21+
- Fixed skybox for ortho cameras.
2122

2223
## [11.0.0] - 2020-10-21
2324

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ Matrix4x4 ComputePixelCoordToWorldSpaceViewDirectionMatrix(ViewConstants viewCon
13851385
}
13861386
Vector2 lensShift = camera.GetGateFittedLensShift();
13871387

1388-
return HDUtils.ComputePixelCoordToWorldSpaceViewDirectionMatrix(verticalFoV, lensShift, resolution, viewConstants.viewMatrix, false, aspect);
1388+
return HDUtils.ComputePixelCoordToWorldSpaceViewDirectionMatrix(verticalFoV, lensShift, resolution, viewConstants.viewMatrix, false, aspect, camera.orthographic);
13891389
}
13901390

13911391
void Dispose()

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/HDUtils.cs

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -140,35 +140,49 @@ internal static int GetRuntimeDebugPanelWidth(HDCamera hdCamera)
140140
internal static float ProjectionMatrixAspect(in Matrix4x4 matrix)
141141
=> - matrix.m11 / matrix.m00;
142142

143-
internal static Matrix4x4 ComputePixelCoordToWorldSpaceViewDirectionMatrix(float verticalFoV, Vector2 lensShift, Vector4 screenSize, Matrix4x4 worldToViewMatrix, bool renderToCubemap, float aspectRatio = -1)
143+
internal static Matrix4x4 ComputePixelCoordToWorldSpaceViewDirectionMatrix(float verticalFoV, Vector2 lensShift, Vector4 screenSize, Matrix4x4 worldToViewMatrix, bool renderToCubemap, float aspectRatio = -1, bool isOrthographic = false)
144144
{
145-
aspectRatio = aspectRatio < 0 ? screenSize.x * screenSize.w : aspectRatio;
145+
Matrix4x4 viewSpaceRasterTransform;
146146

147-
// Compose the view space version first.
148-
// V = -(X, Y, Z), s.t. Z = 1,
149-
// X = (2x / resX - 1) * tan(vFoV / 2) * ar = x * [(2 / resX) * tan(vFoV / 2) * ar] + [-tan(vFoV / 2) * ar] = x * [-m00] + [-m20]
150-
// Y = (2y / resY - 1) * tan(vFoV / 2) = y * [(2 / resY) * tan(vFoV / 2)] + [-tan(vFoV / 2)] = y * [-m11] + [-m21]
147+
if (isOrthographic)
148+
{
149+
// For ortho cameras, project the skybox with no perspective
150+
// the same way as builtin does (case 1264647)
151+
viewSpaceRasterTransform = new Matrix4x4(
152+
new Vector4(-2.0f * screenSize.z, 0.0f, 0.0f, 0.0f),
153+
new Vector4(0.0f, -2.0f * screenSize.w, 0.0f, 0.0f),
154+
new Vector4(1.0f, 1.0f, -1.0f, 0.0f),
155+
new Vector4(0.0f, 0.0f, 0.0f, 0.0f));
156+
}
157+
else
158+
{
159+
// Compose the view space version first.
160+
// V = -(X, Y, Z), s.t. Z = 1,
161+
// X = (2x / resX - 1) * tan(vFoV / 2) * ar = x * [(2 / resX) * tan(vFoV / 2) * ar] + [-tan(vFoV / 2) * ar] = x * [-m00] + [-m20]
162+
// Y = (2y / resY - 1) * tan(vFoV / 2) = y * [(2 / resY) * tan(vFoV / 2)] + [-tan(vFoV / 2)] = y * [-m11] + [-m21]
151163

152-
float tanHalfVertFoV = Mathf.Tan(0.5f * verticalFoV);
164+
aspectRatio = aspectRatio < 0 ? screenSize.x * screenSize.w : aspectRatio;
165+
float tanHalfVertFoV = Mathf.Tan(0.5f * verticalFoV);
153166

154-
// Compose the matrix.
155-
float m21 = (1.0f - 2.0f * lensShift.y) * tanHalfVertFoV;
156-
float m11 = -2.0f * screenSize.w * tanHalfVertFoV;
167+
// Compose the matrix.
168+
float m21 = (1.0f - 2.0f * lensShift.y) * tanHalfVertFoV;
169+
float m11 = -2.0f * screenSize.w * tanHalfVertFoV;
157170

158-
float m20 = (1.0f - 2.0f * lensShift.x) * tanHalfVertFoV * aspectRatio;
159-
float m00 = -2.0f * screenSize.z * tanHalfVertFoV * aspectRatio;
171+
float m20 = (1.0f - 2.0f * lensShift.x) * tanHalfVertFoV * aspectRatio;
172+
float m00 = -2.0f * screenSize.z * tanHalfVertFoV * aspectRatio;
160173

161-
if (renderToCubemap)
162-
{
163-
// Flip Y.
164-
m11 = -m11;
165-
m21 = -m21;
166-
}
174+
if (renderToCubemap)
175+
{
176+
// Flip Y.
177+
m11 = -m11;
178+
m21 = -m21;
179+
}
167180

168-
var viewSpaceRasterTransform = new Matrix4x4(new Vector4(m00, 0.0f, 0.0f, 0.0f),
169-
new Vector4(0.0f, m11, 0.0f, 0.0f),
170-
new Vector4(m20, m21, -1.0f, 0.0f),
171-
new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
181+
viewSpaceRasterTransform = new Matrix4x4(new Vector4(m00, 0.0f, 0.0f, 0.0f),
182+
new Vector4(0.0f, m11, 0.0f, 0.0f),
183+
new Vector4(m20, m21, -1.0f, 0.0f),
184+
new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
185+
}
172186

173187
// Remove the translation component.
174188
var homogeneousZero = new Vector4(0, 0, 0, 1);

0 commit comments

Comments
 (0)