diff --git a/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/024_Shader_PBRvalidation_Specular.png b/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/024_Shader_PBRvalidation_Specular.png index 3aa6f87cb64..ed2eaf5643b 100644 --- a/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/024_Shader_PBRvalidation_Specular.png +++ b/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/024_Shader_PBRvalidation_Specular.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:255b3aa06564dd2afcd90a36be33c1ba7b1cf3e852ccb4f13cad089d0811d997 -size 253255 +oid sha256:e7256595c5777dd284dc8f19e26fe4c7e15336a56c3fb79a63e8dffdea90de62 +size 247243 diff --git a/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/024_Shader_PBRvalidation_Specular.png.meta b/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/024_Shader_PBRvalidation_Specular.png.meta index b52cc45399c..74d6ffeccc9 100644 --- a/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/024_Shader_PBRvalidation_Specular.png.meta +++ b/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/024_Shader_PBRvalidation_Specular.png.meta @@ -24,6 +24,7 @@ TextureImporter: streamingMipmaps: 0 streamingMipmapsPriority: 0 vTOnly: 0 + ignoreMasterTextureLimit: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -32,12 +33,12 @@ TextureImporter: maxTextureSize: 2048 textureSettings: serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 nPOTScale: 1 lightmap: 0 compressionQuality: 50 @@ -88,6 +89,7 @@ TextureImporter: edges: [] weights: [] secondaryTextures: [] + nameFileIdTable: {} spritePackingTag: pSDRemoveMatte: 0 pSDShowRemoveMatteOption: 0 diff --git a/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/025_Shader_PBRvalidation_Metallic.png b/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/025_Shader_PBRvalidation_Metallic.png index 43bbc79e98e..c5ff13895a9 100644 --- a/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/025_Shader_PBRvalidation_Metallic.png +++ b/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/025_Shader_PBRvalidation_Metallic.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ae2d2dd9fe4fc7ee96e170c4859f44e0af3785a9ff3a52af491dbde533471b08 -size 253119 +oid sha256:9e673e15d2cace142ebe6148e7bc7bdf79febd9b75305bbd41f979e2b59d88c4 +size 247977 diff --git a/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/025_Shader_PBRvalidation_Metallic.png.meta b/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/025_Shader_PBRvalidation_Metallic.png.meta index c7ffecee81d..5abeffe8bd8 100644 --- a/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/025_Shader_PBRvalidation_Metallic.png.meta +++ b/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/025_Shader_PBRvalidation_Metallic.png.meta @@ -24,6 +24,7 @@ TextureImporter: streamingMipmaps: 0 streamingMipmapsPriority: 0 vTOnly: 0 + ignoreMasterTextureLimit: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -32,12 +33,12 @@ TextureImporter: maxTextureSize: 2048 textureSettings: serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 nPOTScale: 1 lightmap: 0 compressionQuality: 50 @@ -88,6 +89,7 @@ TextureImporter: edges: [] weights: [] secondaryTextures: [] + nameFileIdTable: {} spritePackingTag: pSDRemoveMatte: 0 pSDShowRemoveMatteOption: 0 diff --git a/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/026_Shader_PBRscene.png b/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/026_Shader_PBRscene.png index dac5168d962..ea1800a7060 100644 --- a/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/026_Shader_PBRscene.png +++ b/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/026_Shader_PBRscene.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:57e36ccfe79d21811429de6d1eff9c15ad4f17ead00eef66113c76c46432049e -size 538124 +oid sha256:0fb54de3272f86ddbf6d2a215cda3748dc397f02db6ebc3ffa8653050a99fd41 +size 537661 diff --git a/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/026_Shader_PBRscene.png.meta b/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/026_Shader_PBRscene.png.meta index 6d8107ed665..96f7a1c015e 100644 --- a/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/026_Shader_PBRscene.png.meta +++ b/TestProjects/UniversalGraphicsTest_Foundation/Assets/ReferenceImages/Linear/iPhonePlayer/Metal/None/026_Shader_PBRscene.png.meta @@ -24,6 +24,7 @@ TextureImporter: streamingMipmaps: 0 streamingMipmapsPriority: 0 vTOnly: 0 + ignoreMasterTextureLimit: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -32,12 +33,12 @@ TextureImporter: maxTextureSize: 2048 textureSettings: serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 nPOTScale: 1 lightmap: 0 compressionQuality: 50 @@ -88,6 +89,7 @@ TextureImporter: edges: [] weights: [] secondaryTextures: [] + nameFileIdTable: {} spritePackingTag: pSDRemoveMatte: 0 pSDShowRemoveMatteOption: 0 diff --git a/TestProjects/UniversalGraphicsTest_Foundation/Assets/Test/TestFilters/TestCaseFilters.asset b/TestProjects/UniversalGraphicsTest_Foundation/Assets/Test/TestFilters/TestCaseFilters.asset index a9a4c72ebed..49db373af05 100644 --- a/TestProjects/UniversalGraphicsTest_Foundation/Assets/Test/TestFilters/TestCaseFilters.asset +++ b/TestProjects/UniversalGraphicsTest_Foundation/Assets/Test/TestFilters/TestCaseFilters.asset @@ -33,17 +33,6 @@ MonoBehaviour: XrSdk: StereoModes: 0 Reason: Needs MSAA fixing on OpenGLES3 - - FilteredScene: {fileID: 0} - FilteredScenes: - - {fileID: 102900000, guid: 2b6b74b7929ae4191b3b936c12236e0a, type: 3} - - {fileID: 102900000, guid: a770620fcd2f84f248d06edf3744b2c0, type: 3} - - {fileID: 102900000, guid: bcb8635ea84c143f0ae0823f1e9b6f25, type: 3} - ColorSpace: -1 - BuildPlatform: -2 - GraphicsDevice: 4 - XrSdk: - StereoModes: 0 - Reason: To be added - FilteredScene: {fileID: 0} FilteredScenes: - {fileID: 102900000, guid: 2b6b74b7929ae4191b3b936c12236e0a, type: 3} diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md index c117c127910..e47b11817f7 100644 --- a/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/com.unity.render-pipelines.universal/CHANGELOG.md @@ -57,6 +57,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed memory leak with XR combined occlusion meshes. [case 1366173] - Fixed a bug with Sprite Targets in ShaderGraph not rendering correctly in game view [1352225] +### Changed +- Remove use of deprecated UNITY_USE_NATIVE_HDR keyword in shaders. + ## [12.0.0] - 2021-01-11 ### Added - Added support for default sprite mask shaders for the 2D Renderer in URP. @@ -228,6 +231,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Support undo of URP Global Settings asset assignation (case 1342987). - Removed unsupported fields from Presets of Light and Camera [case 1335979]. - Fixed graphical artefact when terrain height map is used with rendering layer mask for lighting. +- Fixed URP's vignette effect to respect XR's view center, since with Asymmetric FOV, the center of the view is not always the center of the texture [case 1358336](https://issuetracker.unity3d.com/issues/xr-sdk-urp-vignette-post-processing-effect-is-overlapping-between-eyes) - Fixed an issue where screen space shadows has flickering with deferred mode [case 1354681](https://issuetracker.unity3d.com/issues/screen-space-shadows-flicker-in-scene-view-when-using-deferred-rendering) - Fixed shadowCascadeBlendCullingFactor to be 1.0 - Fixed missing property values in a RendererFeature of screen space shadows by adding tooltip for it instead of showing them. [case 1327356] diff --git a/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs b/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs index 26a0fb5649c..e579c5cedf8 100644 --- a/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs +++ b/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs @@ -510,7 +510,7 @@ void Swap(ref ScriptableRenderer r) // Setup other effects constants SetupLensDistortion(m_Materials.uber, isSceneViewCamera); SetupChromaticAberration(m_Materials.uber); - SetupVignette(m_Materials.uber); + SetupVignette(m_Materials.uber, cameraData.xr); SetupColorGrading(cmd, ref renderingData, m_Materials.uber); // Only apply dithering & grain if there isn't a final pass. @@ -1265,12 +1265,25 @@ void SetupChromaticAberration(Material material) #region Vignette - void SetupVignette(Material material) + void SetupVignette(Material material, XRPass xrPass) { var color = m_Vignette.color.value; var center = m_Vignette.center.value; var aspectRatio = m_Descriptor.width / (float)m_Descriptor.height; + +#if ENABLE_VR && ENABLE_XR_MODULE + if (xrPass != null && xrPass.enabled) + { + if (xrPass.singlePassEnabled) + material.SetVector(ShaderConstants._Vignette_ParamsXR, xrPass.ApplyXRViewCenterOffset(center)); + else + // In multi-pass mode we need to modify the eye center with the values from .xy of the corrected + // center since the version of the shader that is not single-pass will use the value in _Vignette_Params2 + center = xrPass.ApplyXRViewCenterOffset(center); + } +#endif + var v1 = new Vector4( color.r, color.g, color.b, m_Vignette.rounded.value ? aspectRatio : 1f @@ -1533,6 +1546,7 @@ static class ShaderConstants public static readonly int _Chroma_Params = Shader.PropertyToID("_Chroma_Params"); public static readonly int _Vignette_Params1 = Shader.PropertyToID("_Vignette_Params1"); public static readonly int _Vignette_Params2 = Shader.PropertyToID("_Vignette_Params2"); + public static readonly int _Vignette_ParamsXR = Shader.PropertyToID("_Vignette_ParamsXR"); public static readonly int _Lut_Params = Shader.PropertyToID("_Lut_Params"); public static readonly int _UserLut_Params = Shader.PropertyToID("_UserLut_Params"); public static readonly int _InternalLut = Shader.PropertyToID("_InternalLut"); diff --git a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs index be5915726cf..9e710924d28 100644 --- a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs +++ b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs @@ -396,10 +396,11 @@ static void RenderSingleCamera(ScriptableRenderContext context, CameraData camer #if UNITY_EDITOR // Emit scene view UI if (isSceneViewCamera) - { ScriptableRenderContext.EmitWorldGeometryForSceneView(camera); - } + else #endif + if (cameraData.camera.targetTexture != null && cameraData.cameraType != CameraType.Preview) + ScriptableRenderContext.EmitGeometryForCamera(camera); var cullResults = context.Cull(ref cullingParameters); InitializeRenderingData(asset, ref cameraData, ref cullResults, anyPostProcessingEnabled, out var renderingData); diff --git a/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs b/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs index e55c91b7d64..cc3d4f00313 100644 --- a/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs +++ b/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs @@ -855,10 +855,9 @@ public override void Setup(ScriptableRenderContext context, ref RenderingData re } #if UNITY_EDITOR - if (isSceneViewCamera || isGizmosEnabled) + if (isSceneViewCamera || (isGizmosEnabled && lastCameraInTheStack)) { // Scene view camera should always resolve target (not stacked) - Assertions.Assert.IsTrue(lastCameraInTheStack, "Editor camera must resolve target upon finish rendering."); m_FinalDepthCopyPass.Setup(m_DepthTexture, RenderTargetHandle.CameraTarget); m_FinalDepthCopyPass.MssaSamples = 0; EnqueuePass(m_FinalDepthCopyPass); diff --git a/com.unity.render-pipelines.universal/Runtime/XR/XRPass.cs b/com.unity.render-pipelines.universal/Runtime/XR/XRPass.cs index 2fcdb1f0ee7..0cb049c1520 100644 --- a/com.unity.render-pipelines.universal/Runtime/XR/XRPass.cs +++ b/com.unity.render-pipelines.universal/Runtime/XR/XRPass.cs @@ -38,6 +38,7 @@ internal struct XRView internal readonly Rect viewport; internal readonly Mesh occlusionMesh; internal readonly int textureArraySlice; + internal readonly Vector2 eyeCenterUV; internal XRView(Matrix4x4 proj, Matrix4x4 view, Rect vp, int dstSlice) { @@ -46,6 +47,8 @@ internal XRView(Matrix4x4 proj, Matrix4x4 view, Rect vp, int dstSlice) viewport = vp; occlusionMesh = null; textureArraySlice = dstSlice; + + eyeCenterUV = ComputeEyeCenterUV(proj); } internal XRView(XRDisplaySubsystem.XRRenderPass renderPass, XRDisplaySubsystem.XRRenderParameter renderParameter) @@ -61,6 +64,18 @@ internal XRView(XRDisplaySubsystem.XRRenderPass renderPass, XRDisplaySubsystem.X viewport.width *= renderPass.renderTargetDesc.width; viewport.y *= renderPass.renderTargetDesc.height; viewport.height *= renderPass.renderTargetDesc.height; + + eyeCenterUV = ComputeEyeCenterUV(projMatrix); + } + + private static Vector2 ComputeEyeCenterUV(Matrix4x4 proj) + { + var projectionParameters = proj.decomposeProjection; + float left = Math.Abs(projectionParameters.left); + float right = Math.Abs(projectionParameters.right); + float top = Math.Abs(projectionParameters.top); + float bottom = Math.Abs(projectionParameters.bottom); + return new Vector2(left / (right + left), top / (top + bottom)); } } @@ -436,6 +451,26 @@ internal void RenderOcclusionMesh(CommandBuffer cmd) } } + // Take a point that is center-relative (0.5, 0.5) and modify it to be placed relative to the view's center instead, + // respecting the asymmetric FOV (if it is used) + internal Vector4 ApplyXRViewCenterOffset(Vector2 center) + { + Vector4 result = Vector4.zero; + float centerDeltaX = 0.5f - center.x; + float centerDeltaY = 0.5f - center.y; + + result.x = views[0].eyeCenterUV.x - centerDeltaX; + result.y = views[0].eyeCenterUV.y - centerDeltaY; + if (singlePassEnabled) + { + // With single-pass XR, we need to add the data for the 2nd view + result.z = views[1].eyeCenterUV.x - centerDeltaX; + result.w = views[1].eyeCenterUV.y - centerDeltaY; + } + + return result; + } + // Store array to avoid allocating every frame private Matrix4x4[] stereoProjectionMatrix = new Matrix4x4[2]; private Matrix4x4[] stereoViewMatrix = new Matrix4x4[2]; diff --git a/com.unity.render-pipelines.universal/ShaderLibrary/GlobalIllumination.hlsl b/com.unity.render-pipelines.universal/ShaderLibrary/GlobalIllumination.hlsl index 62a65b668a9..a61f658dc82 100644 --- a/com.unity.render-pipelines.universal/ShaderLibrary/GlobalIllumination.hlsl +++ b/com.unity.render-pipelines.universal/ShaderLibrary/GlobalIllumination.hlsl @@ -220,11 +220,7 @@ half3 CalculateIrradianceFromReflectionProbes(half3 reflectVector, float3 positi half4 encodedIrradiance = half4(SAMPLE_TEXTURECUBE_LOD(unity_SpecCube0, samplerunity_SpecCube0, reflectVector, mip)); -#if defined(UNITY_USE_NATIVE_HDR) - irradiance += weightProbe0 * encodedIrradiance.rbg; -#else irradiance += weightProbe0 * DecodeHDREnvironment(encodedIrradiance, unity_SpecCube0_HDR); -#endif // UNITY_USE_NATIVE_HDR } // Sample the second reflection probe @@ -235,11 +231,11 @@ half3 CalculateIrradianceFromReflectionProbes(half3 reflectVector, float3 positi #endif // _REFLECTION_PROBE_BOX_PROJECTION half4 encodedIrradiance = half4(SAMPLE_TEXTURECUBE_LOD(unity_SpecCube1, samplerunity_SpecCube1, reflectVector, mip)); -#if defined(UNITY_USE_NATIVE_HDR) || defined(UNITY_DOTS_INSTANCING_ENABLED) +#if defined(UNITY_DOTS_INSTANCING_ENABLED) irradiance += weightProbe1 * encodedIrradiance.rbg; #else irradiance += weightProbe1 * DecodeHDREnvironment(encodedIrradiance, unity_SpecCube1_HDR); -#endif // UNITY_USE_NATIVE_HDR || UNITY_DOTS_INSTANCING_ENABLED +#endif // UNITY_DOTS_INSTANCING_ENABLED } // Use any remaining weight to blend to environment reflection cube map @@ -247,11 +243,11 @@ half3 CalculateIrradianceFromReflectionProbes(half3 reflectVector, float3 positi { half4 encodedIrradiance = half4(SAMPLE_TEXTURECUBE_LOD(_GlossyEnvironmentCubeMap, sampler_GlossyEnvironmentCubeMap, originalReflectVector, mip)); -#if defined(UNITY_USE_NATIVE_HDR) || defined(UNITY_DOTS_INSTANCING_ENABLED) +#if defined(UNITY_DOTS_INSTANCING_ENABLED) irradiance += (1.0f - totalWeight) * encodedIrradiance.rbg; #else irradiance += (1.0f - totalWeight) * DecodeHDREnvironment(encodedIrradiance, _GlossyEnvironmentCubeMap_HDR); -#endif // UNITY_USE_NATIVE_HDR || UNITY_DOTS_INSTANCING_ENABLED +#endif // UNITY_DOTS_INSTANCING_ENABLED } return irradiance; @@ -271,11 +267,7 @@ half3 GlossyEnvironmentReflection(half3 reflectVector, float3 positionWS, half p half mip = PerceptualRoughnessToMipmapLevel(perceptualRoughness); half4 encodedIrradiance = half4(SAMPLE_TEXTURECUBE_LOD(unity_SpecCube0, samplerunity_SpecCube0, reflectVector, mip)); -#if defined(UNITY_USE_NATIVE_HDR) - irradiance = encodedIrradiance.rgb; -#else irradiance = DecodeHDREnvironment(encodedIrradiance, unity_SpecCube0_HDR); -#endif // UNITY_USE_NATIVE_HDR #endif // _REFLECTION_PROBE_BLENDING return irradiance * occlusion; #else @@ -290,11 +282,7 @@ half3 GlossyEnvironmentReflection(half3 reflectVector, half perceptualRoughness, half mip = PerceptualRoughnessToMipmapLevel(perceptualRoughness); half4 encodedIrradiance = half4(SAMPLE_TEXTURECUBE_LOD(unity_SpecCube0, samplerunity_SpecCube0, reflectVector, mip)); -#if defined(UNITY_USE_NATIVE_HDR) - irradiance = encodedIrradiance.rgb; -#else irradiance = DecodeHDREnvironment(encodedIrradiance, unity_SpecCube0_HDR); -#endif // UNITY_USE_NATIVE_HDR return irradiance * occlusion; #else diff --git a/com.unity.render-pipelines.universal/Shaders/PostProcessing/UberPost.shader b/com.unity.render-pipelines.universal/Shaders/PostProcessing/UberPost.shader index 1b52f04e263..11416a8aab5 100644 --- a/com.unity.render-pipelines.universal/Shaders/PostProcessing/UberPost.shader +++ b/com.unity.render-pipelines.universal/Shaders/PostProcessing/UberPost.shader @@ -46,6 +46,9 @@ Shader "Hidden/Universal Render Pipeline/UberPost" float _Chroma_Params; half4 _Vignette_Params1; float4 _Vignette_Params2; + #ifdef USING_STEREO_MATRICES + float4 _Vignette_ParamsXR; + #endif float2 _Grain_Params; float4 _Grain_TilingParams; float4 _Bloom_Texture_TexelSize; @@ -68,7 +71,12 @@ Shader "Hidden/Universal Render Pipeline/UberPost" #define LensDirtIntensity _LensDirt_Intensity.x #define VignetteColor _Vignette_Params1.xyz + #ifdef USING_STEREO_MATRICES + #define VignetteCenterEye0 _Vignette_ParamsXR.xy + #define VignetteCenterEye1 _Vignette_ParamsXR.zw + #else #define VignetteCenter _Vignette_Params2.xy + #endif #define VignetteIntensity _Vignette_Params2.z #define VignetteSmoothness _Vignette_Params2.w #define VignetteRoundness _Vignette_Params1.w @@ -191,6 +199,12 @@ Shader "Hidden/Universal Render Pipeline/UberPost" UNITY_BRANCH if (VignetteIntensity > 0) { + #ifdef USING_STEREO_MATRICES + // With XR, the views can use asymmetric FOV which will have the center of each + // view be at a different location. + const float2 VignetteCenter = unity_StereoEyeIndex == 0 ? VignetteCenterEye0 : VignetteCenterEye1; + #endif + color = ApplyVignette(color, uvDistorted, VignetteCenter, VignetteIntensity, VignetteRoundness, VignetteSmoothness, VignetteColor); } diff --git a/com.unity.shadergraph/CHANGELOG.md b/com.unity.shadergraph/CHANGELOG.md index 7353b16ffc6..6c5479df006 100644 --- a/com.unity.shadergraph/CHANGELOG.md +++ b/com.unity.shadergraph/CHANGELOG.md @@ -28,9 +28,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed unhandled exception when loading a subgraph with duplicate slots [1366200] (https://issuetracker.unity3d.com/product/unity/issues/guid/1366200/) ## [13.0.0] - 2021-09-01 - -Version Updated -The version number for this package has increased due to a version update of a related graphics package. +### Changed +- Remove use of deprecated UNITY_USE_NATIVE_HDR keyword in shaders. ### Added - Adding control of anisotropic settings on inline Sampler state nodes in ShaderGraph. diff --git a/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Lighting.hlsl b/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Lighting.hlsl index e5b153a4301..1a6eb564076 100644 --- a/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Lighting.hlsl +++ b/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Lighting.hlsl @@ -647,7 +647,7 @@ half3 GlossyEnvironmentReflection(half3 reflectVector, half perceptualRoughness, half4 encodedIrradiance = SAMPLE_TEXTURECUBE_LOD(unity_SpecCube0, samplerunity_SpecCube0, reflectVector, mip); //TODO:DOTS - we need to port probes to live in c# so we can manage this manually. -#if defined(UNITY_USE_NATIVE_HDR) || defined(UNITY_DOTS_INSTANCING_ENABLED) +#if defined(UNITY_DOTS_INSTANCING_ENABLED) half3 irradiance = encodedIrradiance.rgb; #else half3 irradiance = DecodeHDREnvironment(encodedIrradiance, unity_SpecCube0_HDR);