Commit Graph

88 Commits

Author SHA1 Message Date
charles derousiers
074b677276 Fix hair strands shadowing in forward rendering.
Forward rendering now supports up to four shadow casting light, which are stored into the various channels of the shadow masks textures. This CL ensures that the hair mask is written in the proper channels. It also fixes potential light leaks due to invalid transmittance initialization when shadow mask is fully opaque.

#rb none
#jira none

#ROBOMERGE-AUTHOR: charles.derousiers
#ROBOMERGE-SOURCE: CL 18387421 in //UE5/Release-5.0/... via CL 18387432
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v896-18170469)

[CL 18387447 by charles derousiers in ue5-release-engine-test branch]
2021-12-06 15:51:42 -05:00
andrew lauritzen
1dfa763b1f - Generalize one pass projection shadow mask to support up to 32 lights/pixel with 4bpp quantization
- Add some dither noise to both the SMRT result and the shadow mask lookup to minimize banding
- Fall back to a single sample VSM lookup (with a generous static bias) when overflowing the number of lights in one pass projection path
- Fix clamping issue with page dilation that was setting extraneous pages with point lights
- Fix SMRT issue with local lights jammed right next to geometry viewed at a distance
- Separate settings for page dilation for local and directional lights
- Add simple debug output for # lights in one pass projection
- Remove some dead code/parameters

#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18279117 via CL 18373418 via CL 18373449
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18373485 by andrew lauritzen in ue5-release-engine-test branch]
2021-12-03 16:23:04 -05:00
aurel cordonnier
fc542f6cfd Merge from Release-Engine-Staging @ 18081189 to Release-Engine-Test
This represents UE4/Main @18073326, Release-5.0 @18081140 and Dev-PerfTest @18045971

[CL 18081471 by aurel cordonnier in ue5-release-engine-test branch]
2021-11-07 23:43:01 -05:00
aurel cordonnier
a6e741e007 Merge from Release-Engine-Staging @ 17915896 to Release-Engine-Test
This represents UE4/Main @17911760, Release-5.0 @17915875 and Dev-PerfTest @17914035

[CL 17918595 by aurel cordonnier in ue5-release-engine-test branch]
2021-10-25 20:05:28 -04:00
andrew davidson
57beb335f2 Merging //UE5/Dev-LargeWorldCoordinates [at] 17581892 to //UE5/Main
#ROBOMERGE-AUTHOR: andrew.davidson
#ROBOMERGE-SOURCE: CL 17595295 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v871-17566257)

[CL 17595306 by andrew davidson in ue5-release-engine-test branch]
2021-09-22 10:01:48 -04:00
aurel cordonnier
7f517562d5 Merge from Release-Engine-Staging @ 17438845 to Release-Engine-Test
This represents UE4/Main @17430120 and Dev-PerfTest @17437669

[CL 17439044 by aurel cordonnier in ue5-release-engine-test branch]
2021-09-06 12:23:53 -04:00
andrew lauritzen
5ff9308581 Decouple shadow depth rendering from bOcclusionBeforeBasePass.
Remove early shadow depth rendering.

#preflight 6126de4eaf9a8f00019d96fc
#rb daniel.wright
[FYI] brian.karis, graham.wihlidal, ola.olsson, sebastien.hillaire, charles.derousiers

#ROBOMERGE-SOURCE: CL 17312835 via CL 17315510
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v861-17282326)

[CL 17315898 by andrew lauritzen in ue5-release-engine-test branch]
2021-08-26 07:38:44 -04:00
andrew lauritzen
4c09e04e87 Add a cvar to force disabling conventional shadow maps when virtual shadow maps are enabled.
The intention is that lights will eventually take this path automatically when no geometry that can't be rendered into a VSM is present (or no such types exist anymore in the engine).
Fix a few cases where assumptions are made about VSMs only existing if a conventional shadow map exists and so on.
Allow Lumen to consider the VSM result "complete" if valid and no shadow map is present.

#rb Krzysztof.Narkowicz
[FYI] Ola.Olsson
#preflight 611d64805e73720001df629c

#ROBOMERGE-SOURCE: CL 17221692 via CL 17221701
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v855-17104924)

[CL 17221712 by andrew lauritzen in ue5-release-engine-test branch]
2021-08-18 16:28:23 -04:00
christopher waters
e474599a48 EBufferUsageFlags as enum class.
#rb will.damon, rolando.caloca
#preflight 610179041e63730001feb1eb
#preflight 6101b0d5b4288d0001b61c32

#ROBOMERGE-OWNER: christopher.waters
#ROBOMERGE-AUTHOR: christopher.waters
#ROBOMERGE-SOURCE: CL 16986666 via CL 16987824
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v838-16927207)

[CL 16987849 by christopher waters in ue5-release-engine-test branch]
2021-07-28 17:19:36 -04:00
zach bethel
a44fbef833 Incremental fix-up to add names to RDG passes and use the correct RHI command list.
#rb christopher.waters

#ROBOMERGE-SOURCE: CL 16923748 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v836-16769935)

[CL 16923764 by zach bethel in ue5-release-engine-test branch]
2021-07-22 11:00:18 -04:00
andrew lauritzen
37ebf8ceb4 Implement simple subsurface shading model for virtual shadow maps and related fixes and improvements:
- Add VirtualShadowMapId to forward light data, removing the per-view remapping table. Should fixe a few multi-view/split-screen bugs.
- Minor cleanup of PCF subsurface path; remove dead/broken code.
- Fix up blending of light attenuation into screen shadow mask; disable CSM fading when VSMs are enabled.
- Fix OnePassProjection flag when VSMs are disabled

#rb none
[FYI] ola.olsson, brian.karis

#ROBOMERGE-SOURCE: CL 16852407 via CL 16852415
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v836-16769935)

[CL 16852422 by andrew lauritzen in ue5-release-engine-test branch]
2021-07-14 13:45:31 -04:00
Marc Audy
e80ea6b959 Merge from Release-Engine-Staging @ 16444985
This represents UE4/Main @ 16445039 and Dev-PerfTest @ 16444526

[CL 16445122 by Marc Audy in ue5-release-engine-test branch]
2021-05-25 02:43:26 -04:00
Andrew Davidson
3ddc3a4da3 Merge up from //UE5/Dev-LargeWorldCoordinates
#rb none

[CL 16211417 by Andrew Davidson in ue5-main branch]
2021-05-05 15:07:25 -04:00
aurel cordonnier
50944fd712 Merge UE5/RES @ 16162155 to UE5/Main
This represents UE4/Main @ 16130047 and Dev-PerfTest @ 16126156

[CL 16163576 by aurel cordonnier in ue5-main branch]
2021-04-29 19:32:06 -04:00
charles derousiers
bb82b8df32 Apply light function to sub-pixel shadow mask.
#rb kevin.ortegren
#jira UETOP-1298
#lockdown nick.whiting

#ROBOMERGE-SOURCE: CL 16054470 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v789-15992632)

[CL 16061023 by charles derousiers in ue5-main branch]
2021-04-20 10:24:50 -04:00
Marc Audy
01b7c9f4f5 Merge UE5/RES @ 15958325 to UE5/Main
This represents UE4/Main @ 15913390 and Dev-PerfTest @ 15913304

[CL 15958515 by Marc Audy in ue5-main branch]
2021-04-08 14:32:07 -04:00
andrew lauritzen
f6801e3d96 - Fix crash with DirectLighting show flag when VSMs are enabled; always generate light grid as VSM is needed for various indirect lighting effects now too
- Pass shader parameter to disable direct lighting in forward shading when show flag is off
- Fix shadowed lights still getting injected into translucent light volume even when directlighting show flag disabled

#jira UE-102506
#rb graham.wihlidal
[FYI] ola.olsson

#ROBOMERGE-SOURCE: CL 15856585 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v786-15839533)

[CL 15857270 by andrew lauritzen in ue5-main branch]
2021-03-29 20:51:43 -04:00
Daniel Wright
697b5b9cf6 Sparse, narrow band, streamed Mesh Signed Distance Fields
* SDFs are now generated, allocated from the atlas and uploaded in 8^3 bricks (7^3 unique data, half voxel padding).
 * Tracing must load the brick index from the indirection table, and only bricks near the surface are stored
 * 3 mips are now generated, with the lowest resolution always loaded and the other 2 streamed
 * SDFs are now G8 narrow band.  Lower resolution mips must be traversed when querying distance to nearest surface far away from the surface
 * The Distance Field Brick Atlas is now stored for each FScene and dynamically resized based on needs with a GPU memcopy
 * Brick atlas uses a 1d pooled allocator which has no fragmentation and greatly reduces packing waste over the 3d allocator
 * Added new indirection for Distance Field Asset data, so that only a single entry needs to be updated when a mip is streamed in or out in scenes with millions of instances
 * Compute shaders operating on distance field instances generate streaming requests, which are async read back to CPU, turned into IO requests, which are polled and when complete uploaded to atlases
 * Any mesh instance inside the Global SDF extent (200m) requests mip1, and at 50m requests mip2
 * Now using a batched compute scatter to upload to the distance field atlas instead of RHIUpdateTexture3d, to bypass alignment restrictions and per-upload overhead
 * Distance Field streaming uses an async task to move Memcpy and IO request overhead off of the Rendering Thread
 * Distance Field Visualization now computes a normal from the SDF gradient and does simple lighting to better visualize the scene representation
 * Increased r.DistanceFields.MaxPerMeshResolution from 128 to 512, to better represent large objects
 * Mesh SDF generation now uses an Embree point query to calculate closest unsigned distance, and then a much smaller set of rays to count backfaces for negative region determination, for a 11x speedup
 * Upgraded mesh utilities to Embree 3.12.2 to get point queries
 * Fixed wrong transform used for SDF normals in Lumen, causing non-uniformly scaled meshes to have incorrect Surface Cache interpolation
 * Fixed Static Mesh materials not getting PostLoaded before SDF build, causing their blend modes to be wrong for the build, which corrupts the DDC.  Also included those blend modes in the DDC key.

Original costs on 1080 GTX (full updates on everything and no screen traces)
10.60ms   UpdateGlobalDistanceField
3.62ms   LumenReflectiveTest.DirectionalLight_1 Shadowmap 1
1.73ms   VoxelizeCards Clipmaps=[0,1,2,3]
0.38ms   TraceCards 1 dispatch 1 groups
0.51ms   TraceCards 1 dispatch 1 groups

Sparse SDF costs
12.06ms   UpdateGlobalDistanceField
4.35ms   LumenReflectiveTest.DirectionalLight_1 Shadowmap 1
2.30ms   VoxelizeCards Clipmaps=[0,1,2,3]
0.69ms   TraceCards 1 dispatch 1 groups
0.77ms   TraceCards 1 dispatch 1 groups

Tested: TopazEntry PC, Reverb PC and PS5, EngineTests, QAGame, Rift, Frosty P_Construct_WP, FortGPUTestbed

#rb Krzysztof.Narkowicz

#ROBOMERGE-OWNER: Daniel.Wright
#ROBOMERGE-AUTHOR: daniel.wright
#ROBOMERGE-SOURCE: CL 15784493 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v783-15756269)
#ROBOMERGE-CONFLICT from-shelf

[CL 15790658 by Daniel Wright in ue5-main branch]
2021-03-23 22:40:05 -04:00
charles derousiers
6ee4465106 Hair binding update.
#ushell-cherrypick of 15746297 by Charles.deRousiers
#preflight 6055a595c40b0b000164888a

#ROBOMERGE-OWNER: charles.derousiers
#ROBOMERGE-AUTHOR: charles.derousiers
#ROBOMERGE-SOURCE: CL 15753881 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v783-15756269)
#ROBOMERGE-CONFLICT from-shelf

[CL 15766729 by charles derousiers in ue5-main branch]
2021-03-22 14:20:43 -04:00
andrew lauritzen
9b0a6fab9d Remove complete shadow maps and replace with direct VSM sampling
- Move VSM parameters into a single uniform buffer; required for base pass rendering.
  - SRVs are initialized to dummy data until they are computed during the frame and subsequently updated before any VSM sampling.
  - Make names and usage more consistent with other UB bindings in mesh passes
- Direct injection of VSM into translucent volume and fog
- Support VSM sampling in forward lighting shaders
  - Enabled and bound currently for translucent forward and single pass water meshes
- Support VSM sampling in sky atmosphere and cloud rendering
  - NOTE: Sky atmosphere LUT pass currently executes before BasePass and ShadowDepths so it will not sample proper data and throw a warning. Moving passes around to address this will come in a future commit.

#rb Brian.Karis, Ola.Olsson, Sebastien.Hillaire, Zachary.Bethel

#ROBOMERGE-OWNER: andrew.lauritzen
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 15649858 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v779-15635321)
#ROBOMERGE-CONFLICT from-shelf

[CL 15650486 by andrew lauritzen in ue5-main branch]
2021-03-08 23:14:54 -04:00
Emil Persson
4516b985df Name all resources and make naming mandatory
#rb yuriy.odonnel, kenzo.terelst

[CL 15416919 by Emil Persson in ue5-main branch]
2021-02-16 08:37:39 -04:00
daniel wright
b47a37549a Added project settings to choose Dynamic Global Illumination Method and Reflection Method
* These map to r.DynamicGlobalIlluminationMethod and r.ReflectionMethod under the hood
* Removed r.ssgi.enable.  Projects with r.ssgi.enable=1 lose SSGI being enabled, because there�s no way to do backward compatibility on cvars.
* Removed r.LumenScene.  Lumen GI and Reflections are now enabled independently and Lumen Scene will be set up if either feature is enabled.

Setting �Dynamic Global Illumination Method� to Lumen in Project Settings automatically sets �Reflection Method� to Lumen and enables �Generate Mesh Distance Fields�, so you only have to change one setting to convert your project to Lumen.

Newly created projects have:
 * r.GenerateMeshDistanceFields=True.  Needed for Lumen Software tracing.  Note this means all new projects have Mesh Distance Field memory overhead by default.
 * r.DynamicGlobalIlluminationMethod=1 (Lumen)
 * r.ReflectionMethod=1 (Lumen)

Added GI method and Reflection method overrides to Post Process Volume, and new Final Gather Quality and Reflections Quality for Lumen.

Changed the default for r.DistanceFields.DefaultVoxelDensity from .1 to .2, for all projects.  This is needed for good software tracing quality with Lumen.

Lumen GI operates on all lights, regardless of Mobility.  Precomputed shadowing on Stationary lights are ignored, and Lumen will fall back to SDF tracing to solve shadowing for these.

When Lumen GI is enabled, lightmap lighting is discarded in the shader.  This breaks Static lights with lighting built, because their direct lighting is only stored in the lightmap.  A future change will be needed to render Static Lights when Lumen GI is enabled.

NeedsVelocityDepth will be true on any platform that supports Lumen or Ray Tracing.  Lumen needs Velocity Depth but doesn�t have a readonly cvar to use to modify shader compilation.


#ROBOMERGE-SOURCE: CL 15321505 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15321508 by daniel wright in ue5-main branch]
2021-02-04 15:30:42 -04:00
Brian Karis
c69a8a42cc One pass VSM projection, culled by the light grid.
Major SMRT optimization. Adaptive 7 rays per light with rough penumbra detection. Quality appears to surpass 1rpp with denoising.

#rb andrew.lauritzen

[CL 15190972 by Brian Karis in ue5-main branch]
2021-01-25 18:20:37 -04:00
Marc Audy
bc88b73a29 Merge Release-Engine-Staging to Main @ CL# 15151250
Represents UE4/Main @ 15133763

[CL 15158774 by Marc Audy in ue5-main branch]
2021-01-21 16:22:06 -04:00
andrew lauritzen
bd45865fd2 Fix toggling nanite off/on and nanite viewflags off by centralizing the location from which we decide on whether we're using Virtual Shadow Maps or not (top of Render()).
Centralize VSM enable CVar.

#rb ola.olsson

[CL 15052915 by andrew lauritzen in ue5-main branch]
2021-01-12 14:40:19 -04:00