Commit Graph

77 Commits

Author SHA1 Message Date
aurel cordonnier
43fa62fcd8 Merge from Release-Engine-Test @ 16487383 to UE5/Main
This represents UE4/Main @ 16445039 and Dev-PerfTest @ 16444526

[CL 16488106 by aurel cordonnier in ue5-main branch]
2021-05-27 13:40:37 -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
zach bethel
c6cb1e82be Deprecated and gutted FSceneRenderTargets. Moved all textures over to FSceneTextures. Refactored the renderer to use RDG textures from FSceneTextures instead.
#rb arne.schober, luke.thatcher, christopher.waters, kenzo.terelst

[CL 15040082 by zach bethel in ue5-main branch]
2021-01-11 14:49:16 -04:00
andrew lauritzen
82c35c7805 Add a path to sample conventional directional shadow map that does not contain nanite geometry in forward shading passes.
#rb Krzysztof.Narkowicz

[CL 14896015 by andrew lauritzen in ue5-main branch]
2020-12-09 23:02:06 -04:00
zach bethel
ba31d9b2f5 Added FMinimalSceneTextures and FSceneTextures to deferred shading renderer and marshaled it through the render pipeline.
#rb christopher.waters
#rnx

[CL 14780920 by zach bethel in ue5-main branch]
2020-11-18 15:16:23 -04:00
zach bethel
e4f467569d Removed scene render target context snapshot system.
#rb arne.schober

[CL 14615156 by zach bethel in ue5-main branch]
2020-10-29 16:32:16 -04:00
Ola Olsson
2beee3509c Fix light grid injection to use same conditions as before merge from main
- should be enabled for lumen and virtual shadow maps
- also ensure to detect if the light grid was not built before virtual shadow map setup.

#rb rune.stubbe
#fyi Daniel.Wright,Krzysztof.Narkowicz

[CL 14385680 by Ola Olsson in ue5-main branch]
2020-09-24 05:30:24 -04:00
Marcus Wassmer
3b81cf8201 Merging using //UE5/Main_to_//UE5/Release-Engine-Staging @14384769
autoresolved files
#rb none

[CL 14384911 by Marcus Wassmer in ue5-main branch]
2020-09-24 00:43:27 -04:00
andrew lauritzen
3f31b010a0 Add a lower-resolution "complete" shadow map that contains merged Nanite+non-Nanite geometry when virtual shadow maps are enabled
- Use this shadow map for Lumen and volumetrics so that all geometry is present
- Resolution can be controlled with r.Shadow.CompleteShadowMapResolution (default 256). 0 disables, which will result in missing Nanite geometry in these secondary effects (as before this change)
- NOTE: Currently this shadow map is rendered with another pass over the geometry, but this will be replaced by a copy/resample/composite in a future change

Other changes:
- Some fixes to shadow map caching
- Some initial refactors to sorted projected shadow info lists; more to come to reduce the amount of code that iterates and filters AllProjectedShadows around the engine and centralize it in shadow setup.
- Removed unused parameters from a a few functions

#rb ola.olsson
#fyi krzysztof.narkowicz, daniel.wright, sebastien.hillaire

[CL 14224191 by andrew lauritzen in ue5-main branch]
2020-08-31 19:38:04 -04:00
Ola Olsson
ae1039721b Hierarchical Page-Flag fixes & ensure lights are added to light grid when virtual shadow maps are enabled
- Corrected offset calculation for hierarchical page flags.
- Improved consistency of hierarchical page flag lookup.
- Light grid build checks the r.Shadow.v.Enable cvar to enable light injection.

#rb andrew.lauritzen

[CL 14134718 by Ola Olsson in ue5-main branch]
2020-08-18 15:15:25 -04:00
Marc Audy
a7c9001a94 Merging //UE5/Release-Engine-Staging to Main (//UE5/Main) @ 14075166
#rb
#rnx

[CL 14075271 by Marc Audy in ue5-main branch]
2020-08-11 01:36:57 -04:00
Michal Valient
95d19f95b1 [REVERB] Merging //UE4/Private-Reverb-Development@13832732
#rb graham.wihlidal, rune.stubbe, brian.karis, andrew.lauritzen, jeff.farris

[CL 13834854 by Michal Valient in ue5-main branch]
2020-07-06 18:58:26 -04:00
charles derousiers
ff1024d9e1 Fix deep shadow map support when raytracing is enabled.
#rb none
#jira none

#ROBOMERGE-SOURCE: CL 12791247 in //UE4/Release-4.25/... via CL 12791249 via CL 12791250
#ROBOMERGE-BOT: RELEASE (Release-Engine-Staging -> Main) (v681-12776863)

[CL 12791251 by charles derousiers in Main branch]
2020-04-15 07:35:44 -04:00