Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal/2022.3/staging #8016

Merged
merged 34 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a28db4c
URP: Improved renderViewportScale for viewspace intermediate textures.
thomas-zeng Nov 21, 2023
2a76bbe
[22.3] Add missing LoadDOTSInstancedDataOverridden shader functions
vincent-breysse Nov 26, 2023
331c50e
2022.3/documentation staging
RobJessop Nov 26, 2023
0e76ea6
[Port] [2022.3] [2d] Fix (Case UUM-43318) URP freeform lights glitch …
svc-reach-platform-support Nov 27, 2023
356db26
[Port] [2022.3] [VFX] Fix Crash While Creating Subgraph
svc-reach-platform-support Nov 28, 2023
8d40ce1
2022.3: [URP] FullscreenRenderFeature RenderingLayers optimization
AswinRajGopal Nov 29, 2023
e76ff41
2022.3/2d/staging/tilemap/uum55308
ChuanXin-Unity Nov 29, 2023
4c07fad
[Port] [2022.3] [VFX] Replace old style dropdowns with new ones (Oper…
svc-reach-platform-support Nov 29, 2023
16d8e14
[Backport 2022.3][Jira # UUM-52109] Fixing half res transparent hardw…
kecho Nov 30, 2023
e52dfe3
(2022.3) Documentation: Fixed broken includes in HDRP documentation
markg-unity Nov 30, 2023
2e316a1
[2022.3] [Water] Various fixes
adrien-de-tocqueville Nov 30, 2023
9916733
[2022.3][VFX][UUM-51509] Fix Spawner Callbacks used with instancing
ludovic-theobald Dec 1, 2023
069431d
[VFX] Fix Sprite GUI displaying unexpected properties (backport to 20…
PaulDemeulenaere Dec 1, 2023
cf9414c
More blit examples in URP package sample
cinight Dec 4, 2023
f598888
[Port] [2022.3] [UUM-51664][Graphics][URP][2023.3]Fixed light and ref…
svc-reach-platform-support Dec 4, 2023
fd8e595
[2022.3][URP] Fixing Light Layers not taking scene lighting in to acc…
svc-reach-platform-support Dec 4, 2023
40c264f
[Port] [2022.3] [VFX] Fix mismatching Profiler.Begin/EndSample + Avoi…
ludovic-theobald Dec 4, 2023
a71b465
[2022.3] [HDRP] Fix triplanar on alpha clipped geometry
adrien-de-tocqueville Dec 6, 2023
7e6cde6
[2022.3][URP] Performance improvements
ellioman Dec 6, 2023
77b7087
2022.3/documentation staging
RobJessop Dec 10, 2023
00d472f
[URP][2022.3] URP Forward+ Foveated Rendering
mcc-unity Dec 10, 2023
1824939
[Port] [2022.3] Fix LensFlareSRP disable with culling mask and the ga…
svc-reach-platform-support Dec 11, 2023
3459e42
[content automatically redacted] touching PlatformDependent folder
NdBree Dec 12, 2023
94b5d7e
Optimize sky precomputation and memory usage
adrien-de-tocqueville Dec 12, 2023
e9b16cb
[HDRP] Correct raytracing limitation doc
sebastienlagarde Dec 12, 2023
46d0473
[SG] Typos in the node reference sample set - back port of 41289
bencloward Dec 14, 2023
9a20a72
2022.3 Fix SRP Tests missing XR MockHMD during setup.
ewblais Dec 15, 2023
2fc0dcc
UUM-56914 #comment Fixed BiRP shader graph target displaying specular…
joshua-davis Dec 15, 2023
83b63b3
[Backport][2022.3][VFX] Error feedback message updated when shader pa…
julienamsellem Dec 18, 2023
73a51ab
2022.3/documentation staging
RobJessop Dec 18, 2023
38aea40
[Backport 2022.3] [HDRP] Bunch of fixes for HDRP (Version 25)
sebastienlagarde Dec 20, 2023
210a73e
[Backport][2022.3][RPW] Global Settings will always be ensured no ma…
kirill-titov-u Dec 20, 2023
88b7d66
[Backport 2022.3] Fix for Passthrough, it renders the UI but should n…
YohannVaastUnity Dec 31, 2023
bcfba0e
2022.3/documentation staging
RobJessop Dec 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ static void OnBakeStarted()
using (new BakingSetupProfiling(BakingSetupProfiling.Stages.PlaceProbes))
RunPlacement();


currentBakingState = BakingStage.PlacementDone;
}

Expand Down Expand Up @@ -1845,7 +1846,7 @@ public static ProbeSubdivisionResult BakeBricks(ProbeSubdivisionContext ctx)
// Calculate valid renderers to avoid unnecessary work (a renderer needs to overlap a probe volume and match the layer)
var filteredContributors = ctx.contributors.Filter(ctx.profile, cell.bounds, overlappingProbeVolumes);

if (overlappingProbeVolumes.Count == 0 && filteredContributors.Count == 0)
if (filteredContributors.Count == 0 && !overlappingProbeVolumes.Any(v => v.component.fillEmptySpaces))
continue;

var bricks = ProbePlacement.SubdivideCell(cell.bounds, ctx, gpuResources, filteredContributors, overlappingProbeVolumes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,16 @@ void OnDisable()
return true;
cellSizeInMeters = profile.cellSizeInMeters;
}
Camera activeCamera = Camera.current;
#if UNITY_EDITOR
if (activeCamera == null)
activeCamera = UnityEditor.SceneView.lastActiveSceneView.camera;
#endif

if (activeCamera == null)
return true;

var cameraTransform = Camera.current.transform;
var cameraTransform = activeCamera.transform;

Vector3 cellCenterWS = cellPosition * cellSizeInMeters + originWS + Vector3.one * (cellSizeInMeters / 2.0f);

Expand All @@ -240,7 +248,7 @@ void OnDisable()
if (roundedDownDist > ProbeReferenceVolume.instance.probeVolumeDebug.subdivisionViewCullingDistance)
return true;

var frustumPlanes = GeometryUtility.CalculateFrustumPlanes(Camera.current);
var frustumPlanes = GeometryUtility.CalculateFrustumPlanes(activeCamera);
var volumeAABB = new Bounds(cellCenterWS, cellSizeInMeters * Vector3.one);

return !GeometryUtility.TestPlanesAABB(frustumPlanes, volumeAABB);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,21 @@ static public float ShapeAttenuationAreaDiscLight(Vector3 forward, Vector3 wo)
return ShapeAttenuationDirLight(forward, wo);
}

static bool IsLensFlareSRPHidden(Camera cam, LensFlareComponentSRP comp, LensFlareDataSRP data)
{
if (!comp.enabled ||
!comp.gameObject.activeSelf ||
!comp.gameObject.activeInHierarchy ||
data == null ||
data.elements == null ||
data.elements.Length == 0 ||
comp.intensity <= 0.0f ||
((cam.cullingMask & (1 << comp.gameObject.layer)) == 0))
return true;

return false;
}

/// <summary>
/// Compute internal parameters needed to render single flare
/// </summary>
Expand Down Expand Up @@ -480,15 +495,9 @@ static public bool IsCloudLayerOpacityNeeded(Camera cam)
LensFlareComponentSRP comp = info.comp;
LensFlareDataSRP data = comp.lensFlareData;

if (!comp.enabled ||
!comp.gameObject.activeSelf ||
!comp.gameObject.activeInHierarchy ||
data == null ||
data.elements == null ||
data.elements.Length == 0 ||
if (IsLensFlareSRPHidden(cam, comp, data) ||
!comp.useOcclusion ||
(comp.useOcclusion && comp.sampleCount == 0) ||
comp.intensity <= 0.0f)
(comp.useOcclusion && comp.sampleCount == 0))
continue;

if (comp.useBackgroundCloudOcclusion)
Expand Down Expand Up @@ -658,13 +667,7 @@ static public void ComputeOcclusion(Material lensFlareShader, Camera cam,
LensFlareComponentSRP comp = info.comp;
LensFlareDataSRP data = comp.lensFlareData;

if (!comp.enabled ||
!comp.gameObject.activeSelf ||
!comp.gameObject.activeInHierarchy ||
data == null ||
data.elements == null ||
data.elements.Length == 0 ||
comp.intensity <= 0.0f ||
if (IsLensFlareSRPHidden(cam, comp, data) ||
!comp.useOcclusion ||
(comp.useOcclusion && comp.sampleCount == 0))
continue;
Expand Down Expand Up @@ -893,13 +896,7 @@ static public void DoLensFlareDataDrivenCommon(Material lensFlareShader, Camera
LensFlareComponentSRP comp = info.comp;
LensFlareDataSRP data = comp.lensFlareData;

if (!comp.enabled ||
!comp.gameObject.activeSelf ||
!comp.gameObject.activeInHierarchy ||
data == null ||
data.elements == null ||
data.elements.Length == 0 ||
comp.intensity <= 0.0f)
if (IsLensFlareSRPHidden(cam, comp, data))
continue;

#if UNITY_EDITOR
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef UNITY_FOVEATED_RENDERING_METAL_INCLUDED
#define UNITY_FOVEATED_RENDERING_METAL_INCLUDED

#if defined(SHADER_API_METAL) && defined(_FOVEATED_RENDERING_NON_UNIFORM_RASTER) && !defined(UNITY_COMPILER_DXC)
#if !defined(UNITY_COMPILER_DXC) && (defined(UNITY_PLATFORM_OSX) || defined(UNITY_PLATFORM_IOS))

// These are tokens that hlslcc is looking for in order
// to inject variable rasterization rate MSL code.
Expand Down Expand Up @@ -116,7 +116,7 @@
float2 RemapFoveatedRenderingPrevFrameDistort(float2 uv) { return RemapFoveatedRenderingPrevFrameNonUniformToLinear(uv); }
int2 RemapFoveatedRenderingDistortCS(int2 positionCS, bool yflip) { return RemapFoveatedRenderingNonUniformToLinearCS(positionCS, yflip); }

#endif // SHADER_API_METAL && _FOVEATED_RENDERING_NON_UNIFORM_RASTER && !UNITY_COMPILER_DXC
#endif

#endif // UNITY_FOVEATED_RENDERING_METAL_INCLUDED

19 changes: 15 additions & 4 deletions Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,22 @@ real3 ApplyLut2D(TEXTURE2D_PARAM(tex, samplerTex), float3 uvw, float3 scaleOffse
// params = (lut_height, 0.5 / lut_width, 0.5 / lut_height, lut_height / lut_height - 1)
real3 GetLutStripValue(float2 uv, float4 params)
{
uv -= params.yz;
// scale up x from [0,1] to [0,lut_height], so that x is an integer at LUT boundaries (arranged in a strip)
uv.x *= params.x;

// make x vary between 0 and 1 within its LUT
float lutBase = floor(uv.x);
uv.x -= lutBase;

// get the LUT index as value between 0 and (lut_height - 1)/lut_height
float lutBaseU = lutBase * 2.0 * params.z;

// shift the UV to vary between 0 and (lut_height - 1)/lut_height, arrange as color
real3 color;
color.r = frac(uv.x * params.x);
color.b = uv.x - color.r / params.x;
color.g = uv.y;
color.rg = uv - params.zz;
color.b = lutBaseU;

// scale to vary between 0 and 1
return color * params.w;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
#ifndef UNITY_FOVEATED_RENDERING_INCLUDED
#define UNITY_FOVEATED_RENDERING_INCLUDED

#if defined(SHADER_API_PS5) && defined(_FOVEATED_RENDERING_NON_UNIFORM_RASTER)
#include "Packages/com.unity.render-pipelines.ps5/ShaderLibrary/API/FoveatedRendering_PSSL.hlsl"
#endif
#if (!defined(UNITY_COMPILER_DXC) && (defined(UNITY_PLATFORM_OSX) || defined(UNITY_PLATFORM_IOS))) || defined(SHADER_API_PS5)

#if defined(SHADER_API_PS5) || defined(SHADER_API_METAL)

#define SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER 1

#if defined(SHADER_API_PS5)
#include "Packages/com.unity.render-pipelines.ps5/ShaderLibrary/API/FoveatedRendering_PSSL.hlsl"
#endif

#if defined(SHADER_API_METAL)
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/API/FoveatedRendering_Metal.hlsl"
#endif

#endif

#if defined(SHADER_API_METAL) && defined(_FOVEATED_RENDERING_NON_UNIFORM_RASTER)
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/API/FoveatedRendering_Metal.hlsl"
#endif

#endif // UNITY_FOVEATED_RENDERING_INCLUDED
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef UNITY_FOVEATED_RENDERING_KEYWORDS_INCLUDED
#define UNITY_FOVEATED_RENDERING_KEYWORDS_INCLUDED

#if (!defined(UNITY_COMPILER_DXC) && (defined(UNITY_PLATFORM_OSX) || defined(UNITY_PLATFORM_IOS))) || defined(SHADER_API_PS5)

#if defined(SHADER_API_PS5) || defined(SHADER_API_METAL)

#define SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER 1

// On Metal Foveated Rendering is currently not supported with DXC
#pragma warning (disable : 3568) // unknown pragma ignored

#pragma never_use_dxc metal
#pragma dynamic_branch _ _FOVEATED_RENDERING_NON_UNIFORM_RASTER

#pragma warning (default : 3568) // restore unknown pragma ignored

#endif

#endif

#endif // UNITY_FOVEATED_RENDERING_KEYWORDS_INCLUDED

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -473,26 +473,50 @@ half LoadDOTSInstancedData_half(uint metadata)
min16float f16 = min16float(f);
return f16;
}
half LoadDOTSInstancedDataOverridden_half(uint metadata)
{
float f = LoadDOTSInstancedDataOverridden_float(metadata);
min16float f16 = min16float(f);
return f16;
}

half4 LoadDOTSInstancedData_half4(uint metadata)
{
float4 f = LoadDOTSInstancedData_float4(metadata);
min16float4 f16x4 = min16float4(f.x, f.y, f.z, f.w);
return f16x4;
}
half4 LoadDOTSInstancedDataOverridden_half4(uint metadata)
{
float4 f = LoadDOTSInstancedDataOverridden_float4(metadata);
min16float4 f16x4 = min16float4(f.x, f.y, f.z, f.w);
return f16x4;
}

min16float LoadDOTSInstancedData_min16float(uint metadata)
{
return min16float(LoadDOTSInstancedData_half(metadata));
}
min16float LoadDOTSInstancedDataOverridden_min16float(uint metadata)
{
return min16float(LoadDOTSInstancedDataOverridden_half(metadata));
}

min16float4 LoadDOTSInstancedData_min16float4(uint metadata)
{
return min16float4(LoadDOTSInstancedData_half4(metadata));
}
min16float4 LoadDOTSInstancedDataOverridden_min16float4(uint metadata)
{
return min16float4(LoadDOTSInstancedDataOverridden_half4(metadata));
}

min16float LoadDOTSInstancedData_min16float(min16float default_value, uint metadata)
{
return IsDOTSInstancedProperty(metadata) ?
LoadDOTSInstancedData_min16float(metadata) : default_value;
}

min16float4 LoadDOTSInstancedData_min16float4(min16float4 default_value, uint metadata)
{
return IsDOTSInstancedProperty(metadata) ?
Expand All @@ -513,6 +537,19 @@ float4x4 LoadDOTSInstancedData_float4x4(uint metadata)
p1.z, p2.z, p3.z, p4.z,
p1.w, p2.w, p3.w, p4.w);
}
float4x4 LoadDOTSInstancedDataOverridden_float4x4(uint metadata)
{
uint address = ComputeDOTSInstanceDataAddressOverridden(metadata, 4 * 16);
float4 p1 = asfloat(DOTSInstanceData_Load4(address + 0 * 16));
float4 p2 = asfloat(DOTSInstanceData_Load4(address + 1 * 16));
float4 p3 = asfloat(DOTSInstanceData_Load4(address + 2 * 16));
float4 p4 = asfloat(DOTSInstanceData_Load4(address + 3 * 16));
return float4x4(
p1.x, p2.x, p3.x, p4.x,
p1.y, p2.y, p3.y, p4.y,
p1.z, p2.z, p3.z, p4.z,
p1.w, p2.w, p3.w, p4.w);
}

float4x4 LoadDOTSInstancedData_float4x4_from_float3x4(uint metadata)
{
Expand All @@ -528,8 +565,7 @@ float4x4 LoadDOTSInstancedData_float4x4_from_float3x4(uint metadata)
0.0, 0.0, 0.0, 1.0
);
}

float4x4 LoadDOTSInstancedData_float4x4_from_float3x4_overridden(uint metadata)
float4x4 LoadDOTSInstancedDataOverridden_float4x4_from_float3x4(uint metadata)
{
uint address = ComputeDOTSInstanceDataAddressOverridden(metadata, 3 * 16);
float4 p1 = asfloat(DOTSInstanceData_Load4(address + 0 * 16));
Expand All @@ -544,24 +580,20 @@ float4x4 LoadDOTSInstancedData_float4x4_from_float3x4_overridden(uint metadata)
);
}

float4x4 LoadDOTSInstancedData_float4x4_from_float3x4_o2w(uint metadata)
{
// uint metadata = kPerInstanceDataBit | 0;
return LoadDOTSInstancedData_float4x4_from_float3x4_overridden(metadata);
}
float4x4 LoadDOTSInstancedData_float4x4_from_float3x4_w2o(uint metadata)
{
// uint metadata = kPerInstanceDataBit | 48;
return LoadDOTSInstancedData_float4x4_from_float3x4_overridden(metadata);
}

float2x4 LoadDOTSInstancedData_float2x4(uint metadata)
{
uint address = ComputeDOTSInstanceDataAddress(metadata, 4 * 8);
return float2x4(
asfloat(DOTSInstanceData_Load4(address + 0 * 8)),
asfloat(DOTSInstanceData_Load4(address + 1 * 8)));
}
float2x4 LoadDOTSInstancedDataOverridden_float2x4(uint metadata)
{
uint address = ComputeDOTSInstanceDataAddressOverridden(metadata, 4 * 8);
return float2x4(
asfloat(DOTSInstanceData_Load4(address + 0 * 8)),
asfloat(DOTSInstanceData_Load4(address + 1 * 8)));
}

float4x4 LoadDOTSInstancedData_float4x4(float4x4 default_value, uint metadata)
{
Expand All @@ -587,11 +619,21 @@ float2x4 LoadDOTSInstancedData_float2x4(float2x4 default_value, uint metadata)
LoadDOTSInstancedData_float2x4(metadata) : default_value;
}

float4 LoadDOTSInstancedData_RenderingLayer()
float4 LoadDOTSInstancedData_RenderingLayer()
{
return float4(asfloat(unity_DOTSVisibleInstances[0].VisibleData.z), 0,0,0);
}

float3 LoadDOTSInstancedData_MeshLocalBoundCenter()
{
return float3(asfloat(unity_DOTSVisibleInstances[1].VisibleData.z), asfloat(unity_DOTSVisibleInstances[1].VisibleData.w), asfloat(unity_DOTSVisibleInstances[2].VisibleData.z));
}

float3 LoadDOTSInstancedData_MeshLocalBoundExtent()
{
return float3(asfloat(unity_DOTSVisibleInstances[2].VisibleData.w), asfloat(unity_DOTSVisibleInstances[3].VisibleData.z), asfloat(unity_DOTSVisibleInstances[3].VisibleData.w));
}

float4 LoadDOTSInstancedData_MotionVectorsParams()
{
uint flags = unity_DOTSVisibleInstances[0].VisibleData.w;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ When Unity imports an FBX with a compatible 3DS Physical Material shader, it aut
</tr>
</thead>
<tbody>

[!include[](snippets/shader-properties/surface-options/surface-type.md)]
[!include[](snippets/shader-properties/surface-options/rendering-pass.md)]
[!include[](snippets/shader-properties/surface-options/blending-mode.md)]
Expand All @@ -45,6 +46,7 @@ When Unity imports an FBX with a compatible 3DS Physical Material shader, it aut
[!include[](snippets/shader-properties/surface-options/receive-decals.md)]
[!include[](snippets/shader-properties/surface-options/receive-ssr.md)]
[!include[](snippets/shader-properties/surface-options/receive-ssr-transparent.md)]

</tbody>
</table>

Expand All @@ -54,6 +56,7 @@ When Unity imports an FBX with a compatible 3DS Physical Material shader, it aut
<th>Property</th>
<th>Description</th>
</tr>

[!include[](snippets/shader-properties/arnold/base-color-weight.md)]
[!include[](snippets/shader-properties/arnold/base-color.md)]
[!include[](snippets/shader-properties/arnold/base-color-map.md)]
Expand Down Expand Up @@ -82,6 +85,7 @@ When Unity imports an FBX with a compatible 3DS Physical Material shader, it aut
[!include[](snippets/shader-properties/arnold/coat-weight.md)]
[!include[](snippets/shader-properties/arnold/coat-color.md)]
[!include[](snippets/shader-properties/arnold/coat-ior.md)]

</table>

### Advanced Options
Expand All @@ -95,9 +99,11 @@ When Unity imports an FBX with a compatible 3DS Physical Material shader, it aut
</tr>
</thead>
<tbody>

[!include[](snippets/shader-properties/general/enable-gpu-instancing.md)]
[!include[](snippets/shader-properties/general/emission.md)]
[!include[](snippets/shader-properties/general/emission-global-illumination.md)]
[!include[](snippets/shader-properties/general/motion-vector-for-vertex-animation.md)]

</tbody>
</table>
Loading
Loading