Commit Graph

34 Commits

Author SHA1 Message Date
tiago costa
c416078cb9 Fix error when compiling functions in GlobalDistanceFieldDebug.usf that don't need THREADGROUP_SIZE to be defined.
#rb none

[CL 27207900 by tiago costa in ue5-main branch]
2023-08-18 12:44:51 -04:00
tiago costa
557a1b7d93 Print number of updated pages when using r.GlobalDistanceField.Debug.ShowStats.
- also renamed some global distance field debug cvars.

#rb none

[CL 27199378 by tiago costa in ue5-main branch]
2023-08-18 08:01:31 -04:00
tiago costa
473256b3ea Fix incorrect logic in GlobalDistanceField BuildGridTilesCS
#rb krzysztof.narkowicz

[CL 27198583 by tiago costa in ue5-main branch]
2023-08-18 06:41:08 -04:00
tiago costa
22ec307b7d Apply random color to instances when visualizing mesh distance fields.
- plus a couple of small changes.

#rb none

[CL 26183543 by tiago costa in ue5-main branch]
2023-06-22 11:19:51 -04:00
tiago costa
49ba7d483b Fix incorrect NumFreePages calculation in GlobalDistanceFieldDebugCS
- also print NumAllocPages

#rb none

[CL 26086091 by tiago costa in ue5-main branch]
2023-06-19 05:39:16 -04:00
john huelin
4a5d63147b Workaround for a ShaderCompiler issue in the DFAO
[REVIEW]
#rnx

[CL 25701246 by john huelin in ue5-main branch]
2023-05-31 09:59:55 -04:00
tiago costa
5fca726a18 Updated distance field related compute shaders to use wrapped group count in order to support more than 4M instances.
#jira UE-185981
#preflight 646f7e2c0134775be5a94605
#rb Ola.Olsson, Krzysztof.Narkowicz

[CL 25622461 by tiago costa in ue5-main branch]
2023-05-25 11:48:53 -04:00
jian ru
e61377e170 - Add a simple coverage based expand option to global SDF tracing. This mode snaps the coverage to 0 for the entire page if bCoverage is true in the page table entry. Less accurate but avoids an additional texture sample.
- Enable this mode by default for a platform

[REVIEW] [at]krzysztof.narkowicz, [at]john.huelin
#localization none
#tests ReplayRun test and visual test in editor

[CL 25551548 by jian ru in ue5-main branch]
2023-05-19 16:24:19 -04:00
florin pascu
568b9363b7 Global Distance Field For Mobile
Remove bSupportsMobileDistanceField from DDSPI
#rb Dmitriy.Dyomin, Benjamin.Rouveyrol
#jira UE-103863
#preflight 642d669cf376ab43d2c75cec

[CL 24936564 by florin pascu in ue5-main branch]
2023-04-05 17:00:43 -04:00
tiago costa
1737a2782b Fix shader compiler error
- Use LWC codepath in ClipRayToStartOutsideGlobalSDF(...)

#fyi danie.wright
#preflight skip

[CL 24400330 by tiago costa in ue5-main branch]
2023-02-24 09:40:31 -05:00
marc audy
0b73e8ba54 Lumen Reflections do an additional linear screen trace on ray miss, starting from the end of Lumen Scene, giving better distant reflections when it's too expensive to increase Lumen Scene View Distance
* Controlled by r.Lumen.Reflections.DistantScreenTraces
 * Costs ~.08ms on 2080TI at 1080p

#rbx

[CL 24397841 by marc audy in ue5-main branch]
2023-02-24 04:01:13 -05:00
krzysztof narkowicz
196daca678 Lumen Software Ray Tracing - improved global distance field hit evaluation
* Added a small bias along the normal in order to minimize leaking, which was caused by sampling card grid cell inside a wall. This fixes issues with object order when they are placed near to each other.
* Move card hit point closer to the surface, as all hit points are biased by SDFTraceResult.ExpandSurfaceAmount in order to escape uncertain SDF region. This provides a bit more precise hit point and improves card sampling quality.

[FYI] Daniel.Wright

[CL 24197434 by krzysztof narkowicz in ue5-main branch]
2023-02-13 20:08:44 -05:00
Daniel Wright
9763c9447f The Global SDF will recapture the first two clipmaps if they cache Mesh SDFs which haven't streamed in yet, fixing the Global SDF after a teleport or new map load
* CullObjectsToClipmapCS writes to a buffer when any incomplete Mesh SDFs are used, which is read back by the CPU and a new clipmap update gets queued for when streaming is complete
 * Controlled by r.AOGlobalDistanceField.RecacheClipmapsWithPendingStreaming (enabled by default)
 * New debug option to profile the cost of heightfield / Mesh SDF streaming recaches: r.AOGlobalDistanceField.ForceRecacheForStreaming
 * New information added to the draw event to debug full recapture reasons: "Clipmap:0 CacheType:MostlyStatic FULL UPDATE: HeightfieldStreaming"
#preflight none

[CL 23932238 by Daniel Wright in ue5-main branch]
2023-01-31 13:28:58 -05:00
tiago costa
e3625cbdd5 Sample Global SDF in Translated World Space
- Modified WorldToUVAddAndMul and similar to convert from translated world space.
- Use FInt64Vector to track update origin.
- Apply modulo to ScrollOffset before converting to float.

#jira UE-166912
#jira UE-140552
#preflight 638669e133774509007e2237
#rb Krzysztof.Narkowicz, rob.krajcarski, daniel.wright

[CL 23316846 by tiago costa in ue5-main branch]
2022-11-29 15:50:09 -05:00
tiago costa
884f3d3c8a Don't bind view uniform buffer to Global SDF update shaders
#rb none
#preflight 63610b91731604696a0975fc

[CL 22880212 by tiago costa in ue5-main branch]
2022-11-01 08:21:14 -04:00
tiago costa
c9552fea3f Fix incorrect CalculateDistanceFieldApproxAO(...) definition if !PLATFORM_SUPPORTS_DISTANCE_FIELDS
#rb none
#preflight none

[CL 22880083 by tiago costa in ue5-main branch]
2022-11-01 08:08:24 -04:00
eric mcdaniel
502749c59a Fix for async compute on platforms with memory boundary restrictions on async compute dispatch indirect arguments
*** This change will incur a full shader invalidation across all platforms ***

Issues:
  - Some platforms require async compute dispatch indirect arguments to not cross specific memory boundaries
    - This places restrictions on the valid sizes for a dispatch indirect argument set.  We were not conforming to these restrictions which could result in GPU crashes on these async passes

Fixes:
  - FRHIDispatchIndirectParameters is padded out to meet per-platform memory boundary restrictions
    - This is driven via new per-platform preprocessor define PLATFORM_DISPATCH_INDIRECT_ARGUMENT_BOUNDARY_SIZE
    - Some platforms require FRHIDispatchIndirectParameters to align with their internal structure hence we cannot universally size to meet all platform's requirements

  - Introduce new FRHIDispatchIndirectParametersNoPadding for uses when we explicitly do not want the padding and otherwise avoid the memory boundary restrictions

  - Revise and expand indirect argument validation code to catch further such issues in the future

  - Update shaders which write to dispatch indirect argument buffers to account for optional per-platform padding
    - New utility function WriteDispatchIndirectArgs introduced to faciliate this
    - platforms which require other than the default nonpadded dispatch indirect arguments must define DISPATCH_INDIRECT_UINT_COUNT and their own WriteDispatchIndirectArgs in their CommonPlatform.ush

  - move creation of DispatchIndirectGraphicsCommandSignature command signature to be per-platform
    - DispatchIndirectGraphicsCommandSignature and DispatchIndirectComputeCommandSignature stride changed to account for additional padding on impacted platforms

Testing:
  - ran Lyra with and without async compute Lumen on impacted platforms as well as Win64
  - ran FN replay on impacted platforms

#rb Krzysztof.Narkowicz, Ben.Woodhouse, Benjamin.Rouveyrol
#jira UE-167950
#preflight 6359563b2e6690262a11bc06

[CL 22862498 by eric mcdaniel in ue5-main branch]
2022-10-31 10:15:11 -04:00
krzysztof narkowicz
b7b5335ae9 Global Distance Field - reconstruct heightfield normal using central differences instead of sampling it from the heightfield texture. It�s a better approximation of a normal over a certain area, resulting in a better plane fit to heightfield and thus improved distance field quality, which means in practice less holes and black areas in Lumen.
[FYI] Tiago.Costa, Daniel.Wright

[CL 22576927 by krzysztof narkowicz in ue5-main branch]
2022-10-17 16:34:57 -04:00
krzysztof narkowicz
efb1f95654 Lumen Sofwatre Ray Tracing - fixed Global SDF object grid culling, which was incorrectly computing grid cell centers.
[CL 22547731 by krzysztof narkowicz in ue5-main branch]
2022-10-15 02:08:49 -04:00
krzysztof narkowicz
5c86522ed4 Added AffectIndirectLightingWhileHidden property to primitive component.
Following the existing CastHiddenShadow, AffectIndirectLightingWhileHidden allows hidden primitives to be injected into GI and reflections. This is useful as an extra art direction knob to create cheap invisible area lights through GI.

* Only implemented in Lumen
* Will inject {Visible=false, AffectIndirectLightingWhileHidden=true} primitives into both distance field scene and ray tracing scene (TLAS)

#rb Daniel.Wright, Yuriy.ODonnell

[CL 22412764 by krzysztof narkowicz in ue5-main branch]
2022-10-07 19:44:48 -04:00
krzysztof narkowicz
43bc1719fb Global Distance Field - fixed debug stats for r.AOGlobalDistanceFieldCacheMostlyStaticSeparately=0
[CL 22203093 by krzysztof narkowicz in ue5-main branch]
2022-09-27 06:59:17 -04:00
krzysztof narkowicz
f3bf236d1e Global Distance Field - fixed heightfield page allocation reducing number of required pages by 5%. Also added debug code for counting filled pages (pages having values outside of 0 or 1, which need to be allocated and filled).
[FYI] Tiago.Costa

[CL 22191882 by krzysztof narkowicz in ue5-main branch]
2022-09-26 15:22:52 -04:00
krzysztof narkowicz
d1ca6d0cdc Lumen - optimized global distance field tracing by skipping coverage data sampling if it�s not required. Coverage data is used only for foliage partial transparency, but we were sampling it everywhere adding overhead to every trace even when there was no foliage around.
During page composite pass, pages containing coverage values below 1 are marked using a single bit inside PageTable. This bit is then checked during the tracing pass to decide whether we should load a sparse coverage page or not.

Previously we were marking empty areas as coverage 0, but it had some side effects and isn�t compatible with this marking scheme. Now all empty space is marked as coverage=1 and mobility cache composition was accordingly modified.

Performance wins on FortGPUTestBed, all tracing passes, current gen console, 1080p
Epic - 0.17ms
High - 0.1ms

Unfortunately this doesn�t fully remove coverage overhead in levels without foliage. Overhead after this optimization:
Epic - 0.1ms
High - 0.06ms

[CL 22165335 by krzysztof narkowicz in ue5-main branch]
2022-09-23 20:45:46 -04:00
krzysztof narkowicz
67640fd1c7 Lumen - don't store interiors of the objects inside the object grid, as those don't have a valid surface in a given cell.
[CL 22055826 by krzysztof narkowicz in ue5-main branch]
2022-09-16 14:30:52 -04:00
jian ru
b5608b7b5b Add options to run Lumen passes on async compute. Also added an option to disable async nanite rasterization for shadow depths only so lumen passes can overlap with shadow depths.
#rb krzysztof.narkowicz
[FYI] krzysztof.narkowicz, daniel.wright

[CL 21997760 by jian ru in ue5-main branch]
2022-09-13 21:47:35 -04:00