Files
UnrealEngineUWP/Engine/Shaders/Private/RenderGraphUtilities.usf

48 lines
1.4 KiB
Plaintext
Raw Normal View History

// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
RenderGraphUtilities.usf
=============================================================================*/
#include "Common.ush"
Buffer<uint4> RectCoordBuffer; // [MinX, MinY, MaxX, MaxY]
Buffer<uint4> RectUVBuffer;
float DownsampleFactor;
float2 InvViewSize;
float2 InvTextureSize;
bool2 VertMax(uint VertexId)
{
bool2 bVertMax;
bVertMax.x = VertexId == 1 || VertexId == 2 || VertexId == 4;
bVertMax.y = VertexId == 2 || VertexId == 4 || VertexId == 5;
return bVertMax;
}
void RasterizeToRectsVS(
in uint InstanceId : SV_InstanceID,
in uint VertexId : SV_VertexID,
out float4 OutPosition : SV_POSITION,
Radiosity gather with spatial and temporal reuse * Radiosity integration and temporal accumulation are now full resolution * Radiosity traces from probe positions, controlled by r.LumenScene.Radiosity.ProbeSpacing and r.LumenScene.Radiosity.HemisphereProbeResolution Spatial reuse * Spatial filtering on probe radiance * Probe interpolation and spatial filter implement probe plane weighting and probe occlusion to reduce leaking * No spatial filtering across cards yet Temporal reuse * Ray directions and probe placement are jittered across page updates, with the final integrated irradiance temporally accumulated using linear weights * Radiosity integration now temporally accumulates using typed UAV loads. History length is controlled by r.LumenScene.Radiosity.Temporal.MaxFramesAccumulated * Card pages to be updated for Radiosity are resampled from the indirect lighting atlas to the new resolution in the card capture atlas, and then copied back to the indirect lighting atlas, maintaining Radiosity history when card pages are resized (r.LumenScene.SurfaceCache.ResampleLighting) Hardware Ray Tracing * Radiosity traces now use AvoidSelfIntersectionTrace, which skips backfaces for a short distance and then intersects backfaces for the rest of the trace to prevent leaking even when starting somewhat inside the mesh * The Surface Cache is no longer interpolated to trace backface hits, fixing leaking, and preventing Radiosity texels inside walls from picking up sky lighting Costs the same as previous Radiosity gather, but adds 160mb for all the persistent atlases. Lighting propagation speed is 4x slower due to r.LumenScene.Radiosity.Temporal.MaxFramesAccumulated. #preflight 61eb773c5706089488f734e0 #rb Patrick.Kelly #ROBOMERGE-AUTHOR: daniel.wright #ROBOMERGE-SOURCE: CL 18710273 in //UE5/Release-5.0/... via CL 18710287 via CL 18710529 #ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472) [CL 18710632 by daniel wright in ue5-main branch]
2022-01-24 12:32:42 -05:00
out float2 OutUV : TEXCOORD0,
out float2 OutRectUV : TEXCOORD1,
out float OutRectIndex : RECT_INDEX)
{
uint4 RectCoord = RectCoordBuffer[InstanceId] * DownsampleFactor;
uint2 VertexCoord = select(VertMax(VertexId), RectCoord.zw, RectCoord.xy);
float4 RectUV = RectCoord * InvViewSize.xyxy;
#if RECT_UV
{
RectUV = RectUVBuffer[InstanceId] * DownsampleFactor * InvTextureSize.xyxy;
}
#endif
float2 VertexUV = select(VertMax(VertexId), RectUV.zw, RectUV.xy);
OutPosition = float4(float2(VertexCoord) * InvViewSize * float2(2.0f, -2.0f) + float2(-1.0, 1.0f), 0.0f, 1.0f);
OutUV = VertexUV;
OutRectUV.x = VertMax(VertexId).x ? 1.0f : 0.0f;
OutRectUV.y = VertMax(VertexId).y ? 1.0f : 0.0f;
Radiosity gather with spatial and temporal reuse * Radiosity integration and temporal accumulation are now full resolution * Radiosity traces from probe positions, controlled by r.LumenScene.Radiosity.ProbeSpacing and r.LumenScene.Radiosity.HemisphereProbeResolution Spatial reuse * Spatial filtering on probe radiance * Probe interpolation and spatial filter implement probe plane weighting and probe occlusion to reduce leaking * No spatial filtering across cards yet Temporal reuse * Ray directions and probe placement are jittered across page updates, with the final integrated irradiance temporally accumulated using linear weights * Radiosity integration now temporally accumulates using typed UAV loads. History length is controlled by r.LumenScene.Radiosity.Temporal.MaxFramesAccumulated * Card pages to be updated for Radiosity are resampled from the indirect lighting atlas to the new resolution in the card capture atlas, and then copied back to the indirect lighting atlas, maintaining Radiosity history when card pages are resized (r.LumenScene.SurfaceCache.ResampleLighting) Hardware Ray Tracing * Radiosity traces now use AvoidSelfIntersectionTrace, which skips backfaces for a short distance and then intersects backfaces for the rest of the trace to prevent leaking even when starting somewhat inside the mesh * The Surface Cache is no longer interpolated to trace backface hits, fixing leaking, and preventing Radiosity texels inside walls from picking up sky lighting Costs the same as previous Radiosity gather, but adds 160mb for all the persistent atlases. Lighting propagation speed is 4x slower due to r.LumenScene.Radiosity.Temporal.MaxFramesAccumulated. #preflight 61eb773c5706089488f734e0 #rb Patrick.Kelly #ROBOMERGE-AUTHOR: daniel.wright #ROBOMERGE-SOURCE: CL 18710273 in //UE5/Release-5.0/... via CL 18710287 via CL 18710529 #ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472) [CL 18710632 by daniel wright in ue5-main branch]
2022-01-24 12:32:42 -05:00
OutRectIndex = InstanceId;
}