Commit Graph

227 Commits

Author SHA1 Message Date
tiago costa
d02ba08f8c Support Callable/Miss shaders in MeshPassProcessor.
- useful to gather shader bindings to evaluate materials in callable shaders.
- similar to how it supports compute and hit group shaders.

#rb yuriy.odonnell
#preflight 6287503ac057ee6e23f2f8dc

[CL 20292265 by tiago costa in ue5-main branch]
2022-05-20 05:18:06 -04:00
tiago costa
245b5ce6d5 Don't apply far field offset to CachedRayTracingInstanceWorldBounds.
- raytracing instance culling doesn't apply far field offset to view origin (FRayTracingCullPrimitiveInstancesClosure::operator()).
- also don't need to refresh cached raytracing instances when far field offset changes anymore.

#preflight 6273d7e46a646b1d153e8e7d
#rb Patrick.Kelly

[CL 20057351 by tiago costa in ue5-main branch]
2022-05-05 10:11:00 -04:00
Yuriy ODonnell
b26d9c4423 Exclude primitives that are meant to be hidden in game from ray tracing scene when game view is enabled or in PIE mode.
#rb krzysztof.narkowicz
#preflight 62705ebf645c64f3a25dd240

[CL 20041668 by Yuriy ODonnell in ue5-main branch]
2022-05-04 10:37:45 -04:00
Yuriy ODonnell
32ebaf5460 Fix crash when r.RayTracing.Shadows is enabled dynamically
Previously FScene contained an array of RT-shadowed lights which was updated when a light is added/removed.
However, this is incorrect as the light RT shadow state depends on CVars that may be changed dynamically.

The solution is to check if the scene currently contains any RT-shadowed lights during rendering. This is more expensive but robust.
The array of RT-shadowed lights is removed as it was not used beyond checking if it's empty.

#rb juan.canada
#preflight 6271aa653e1f2a9d3a4dd84c

[CL 20041248 by Yuriy ODonnell in ue5-main branch]
2022-05-04 10:05:02 -04:00
Juan Canada
00aa934c9d Ray tracing now takes into account the VisibleInSceneCapturesOnly flag
#rb yuriy.odonnell
#jira none
#preflight 62701b408063424f88b06017

[CL 20012394 by Juan Canada in ue5-main branch]
2022-05-02 14:11:04 -04:00
Wei Liu
04d7580d62 Clustered local lights and reflections are supported on mobile forward and deferred.
Local light shadows are supported on mobile forward and deferred, need to enable full depth prepass to generate the ShadowMaskTexture.

Remove the 4 maximum local lights limitation on mobile forward.

Remove the "High Quality Reflection" on mobile forward.

Disable simple lights on mobile forward.

#jira UE-149064

#rb Dmitriy.Dyomin

#preflight 625d17da772cf82d3a6059a6

[CL 19784597 by Wei Liu in ue5-main branch]
2022-04-18 09:09:40 -04:00
charles derousiers
0195d6b7aa Add OIT per-pixel sorting support for translucent material
This technique is guarded with by a projected settings. It is currently only supported on PC Dx12. This is the initial step for fine grain/per-pixel sorting.

#rb sebastien.hillaire
#jira none
#preflight 623a1884bc1cf2803867d8f8

[CL 19470340 by charles derousiers in ue5-main branch]
2022-03-22 15:06:48 -04:00
tiago costa
5440dbed90 Support applying local bounds scale and center translation to ray tracing instance transform.
- Useful for procedural raytracing geometries.

#rb aleksander.netzel
#preflight 6230a67c050dc69468ba0b33

[CL 19386052 by tiago costa in ue5-main branch]
2022-03-15 11:00:54 -04:00
tiago costa
e5ed51d375 Fix compiler warning
- Check that both InstanceTransforms and InstanceTransformsView are empty

#rb none
#preflight none
#jira none

[CL 19306476 by tiago costa in ue5-main branch]
2022-03-08 13:25:25 -05:00
tiago costa
e01a204611 Get instance transforms of Primitives supporting ERayTracingPrimitiveFlags::CacheInstances from GPUScene.
- Avoid extra copy and upload of transforms.
- Added FRayTracingGeometryInstance::BaseInstanceSceneDataOffset to skip creating an array of instance data offsets when they are continuous.
- Saves around 50MB on CitySample.

#rb yuriy.odonnell
#preflight 6225f85bb97fb949cf3518fa

[CL 19302183 by tiago costa in ue5-main branch]
2022-03-08 09:20:04 -05:00
graham wihlidal
80fe1cc207 Further work on Nanite programmable rasterizer - barebones WPO support, material relevancy improvements, and improvements to rasterizer and vertex factory shaders
#preflight 621ec9e2257fd6e0993b80e8
#rb ben.ingram
#fyi brian.karis, rune.stubbe, jamie.hayes
#robomerge FNNC

[CL 19216345 by graham wihlidal in ue5-main branch]
2022-03-01 22:16:13 -05:00
Brian Karis
dba24ab6be FDynamicBVH now supports a forest with a spatial hash at the highest level to support LWC without the need for doubles for bounding boxes.
Switched FDynamicBVH to use greedy insertion because branch and bound perf significantly degrades with heavily overlapped leaves.

Added closest point queries using branch and bound.

FBounds is now templated as TBounds.

#rb graham.wihlidal
#robomerge FNNC
#preflight 6216dbf9104496cff8abfc36

[CL 19107993 by Brian Karis in ue5-main branch]
2022-02-23 21:17:53 -05:00
graham wihlidal
4171f6f73f Big rewrite/optimization of Nanite programmable raster pipeline registration with GPUScene on the CPU, added raster bin visualization plus duplicate define code cleanup, added initial WIP two sided material support (will optimize the math shortly), and fixed a number of programmable raster VSM related bugs.
#rb brian.karis
#fyi rune.stubbe, jamie.hayes
#preflight 6216c0b0f8704e8ca91c7dbd
#robomerge FNNC

[CL 19104646 by graham wihlidal in ue5-main branch]
2022-02-23 18:42:05 -05:00
graham wihlidal
cf25af65a7 Replace Raster/ShadingMaterial WeakObjectkPtr with FMaterialRenderProxy: accessing WeakObjectPtr on render thread led to a race condition.
#rb Graham.Wihlidal
#preflight 620ed139e8554a6f64ef8115
#jira UE-141348

#ushell-cherrypick of 19048514 by swarm

[CL 19061926 by graham wihlidal in ue5-main branch]
2022-02-19 00:16:02 -05:00
chris kulla
862d615ec1 Allow caching of ray tracing instances for preview scenes
This enables the use of path tracing for the material editor and static mesh editors.

#rb Juan.Canada
#preflight 620c5818492761fc5ca38895

[CL 19009187 by chris kulla in ue5-main branch]
2022-02-15 21:07:37 -05:00
graham wihlidal
b2376c8e92 Implemented initial Nanite raster pipeline register/unregister/de-duplication, including launching each raster pipeline during Nanite rasterization if programmable raster is enabled. Also hooked up graph GetMaterialMask() to Nanite HW raster pixel shader stage.
#fyi brian.karis, rune.stubbe
#preflight 62097af2d332bab853f5eb79

[CL 18975360 by graham wihlidal in ue5-main branch]
2022-02-13 16:45:21 -05:00
graham wihlidal
3d89d9a647 Initial submit of Nanite programmable raster binning/framework (disabled by default, and missing some WIP pieces for it to function correctly). Later submits will enable it, and also include numerous optimizations.
#rb brian.karis
#fyi rune.stubbe, ola.olsson
#preflight 6206fdc9c663666c89ba1b9f

[CL 18971638 by graham wihlidal in ue5-main branch]
2022-02-11 22:50:10 -05:00
tiago costa
fb5aca2e15 Fix far field offset not being applied to non-nanite static meshes.
Context:
- There was a toggle in editor to assign primitives to FarField. However we currently only support HLODs in FarField.
- Only primitives with ERayTracingPrimitiveFlags::CacheInstances were getting mask set to RAY_TRACING_MASK_FAR_FIELD and ERayTracingPrimitiveFlags::FarField when assigned to FarField.
- Code path that gets instance transform from GPU scene when building RT instance buffer didn't apply FarField offset.

Change:
- Remove Editor toggle to control bRayTracingFarField assignment. HLODBuilder internally sets the flag when necessary.
- Don't modify ERayTracingPrimitiveFlags in FPrimitiveSceneInfo::UpdateCachedRayTracingInstance(...)
- Apply ERayTracingPrimitiveFlags::FarField in FPrimitiveSceneProxy::GetCachedRayTracingInstance(...)
- BuildRayTracingInstanceMaskAndFlags(...) applies RAY_TRACING_MASK_FAR_FIELD when requested.
- Apply FarField offset to GPUScene instances when building RT instance buffer.

#jira UE-141023
#rb yuriy.odonnell
#preflight 620394474c05b86e6d60770e
#lockdown juan.canada

#ROBOMERGE-AUTHOR: tiago.costa
#ROBOMERGE-SOURCE: CL 18916037 in //UE5/Release-5.0/... via CL 18920345 via CL 18922711
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v916-18915374)

[CL 18923433 by tiago costa in ue5-main branch]
2022-02-09 15:12:03 -05:00
tiago costa
2b5a1197de Fix non-nanite static meshes not rendering in ray tracing when UpdateCachedRayTracingInstances() is called.
- We were using ERayTracingPrimitiveFlags::CacheMeshCommands to identify non-nanite static meshes. This flag was set in CacheRayTracingPrimitive<...>(...) along with ERayTracingPrimitiveFlags::ComputeLOD.
- When UpdateCachedRayTracingInstances() is called (for example due to FarField ReferencePos changing)  that primitive flag override is lost and non-nanite static meshes stop being added to RaytracingScene.

Fix:
- Stop overriding PrimitiveRayTracingFlags in CacheRayTracingPrimitive<...>(...).
- Added new flag ERayTracingPrimitiveFlags::StaticMesh to identify IsRayTracingStaticRelevant() instances instead of hijacking ERayTracingPrimitiveFlags::CacheMeshCommands.
- Apply ERayTracingPrimitiveFlags::StaticMesh | ERayTracingPrimitiveFlags::ComputeLOD when necessary in FPrimitiveSceneProxy::GetCachedRayTracingInstance(...)

#jira UE-141118, UE-141023
#rb yuriy.odonnell
#preflight 61fbd9ae176256ec4f6ff575
#lockdown michal.valient

#ROBOMERGE-AUTHOR: tiago.costa
#ROBOMERGE-SOURCE: CL 18844466 in //UE5/Release-5.0/... via CL 18844471 via CL 18844741
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18844747 by tiago costa in ue5-main branch]
2022-02-03 12:31:51 -05:00
tiago costa
d955287dbe Remove unused r.CachedRayTracingInstances.CacheLocalTransform/LazyUpdate
- Only keep default codepaths (dont cache local transform, use lazy update)

#rb yuriy.odonnell
#preflight 61fa8ad3cc4b837d9c5d2f44

[CL 18825564 by tiago costa in ue5-main branch]
2022-02-02 08:59:30 -05:00
juan canada
35fde9c194 Fixed raytracing scene captures were using the reflection captures visibility flag instead of the scene captures visibility flag
rb graham.wilhidal
#preflight 61f476ac801201ab389a8491

#ROBOMERGE-AUTHOR: juan.canada
#ROBOMERGE-SOURCE: CL 18780154 in //UE5/Release-5.0/... via CL 18780926 via CL 18781356
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18781653 by juan canada in ue5-main branch]
2022-01-28 19:48:38 -05:00
graham wihlidal
001c9a03ac Fix for broken/shuffled Nanite materials when commands like FUpdateStaticMeshesForMaterials call FPrimitiveSceneInfo::UpdateStaticMeshes(), which recaches Nanite mesh draw commands (and deriving new material table indices), but no other change will cause GPU Scene to perform a per-primitive upload (which would also update the global material tables). This change modifies FPrimitiveSceneInfo::UpdateStaticMeshes() to trigger a GPU Scene update so the MDCs and the global material table stay synchronized. Normally adding a primitive to the scene will mark GPU Scene dirty, but some cases of construction scripts adding to the scene, flushing the upload, but then changing just the static meshes or material assignments wouldn't flush an update prior to this change.
#rb ola.olsson
#jira UE-139332, UE-137158
#preflight 61f026411f5c4c6f6497890a

#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 18724431 in //UE5/Release-5.0/... via CL 18724477 via CL 18724718
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18724764 by graham wihlidal in ue5-main branch]
2022-01-25 12:42:35 -05:00
ben ingram
7ae8e132e7 Allow FBoxSphereBounds to use different types for position/extent
FPrimitiveSceneInfoCompact uses float extent for bounds
#jira UE-137200
#rb andrew.davidson
#preflight 61e899e28022cea656998dc0

#ROBOMERGE-AUTHOR: ben.ingram
#ROBOMERGE-SOURCE: CL 18669012 in //UE5/Release-5.0/... via CL 18669053 via CL 18669074
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v901-18665521)

[CL 18669106 by ben ingram in ue5-main branch]
2022-01-19 18:58:21 -05:00
ola olsson
825daf7529 Add persistent primitive index (FPrimitiveSceneInfo::PersistentIndex) which is stable for the life-time of a primitive (proxy) in FScene
- can be used to track information about a primitive over time without needing to track changes in PackedPrimitiveIndex
- will have the same high-water mark to packed index, but will persist for longer, potentially (allocator picks new from the front).
- Add PersistentPrimitiveIndex to FPrimitiveSceneData / SceneData.ush, to enable access on the GPU
- Add FSpanAllocator, an incremental improvement over FGrowOnlySpanAllocator - which shrinks as well and has efficient allocation of unit-sized allocations.

#rb rune.stubbe,Krzysztof.Narkowicz
#preflight 61e6b538837b79f7ccdc860f

#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 18638699 in //UE5/Release-5.0/... via CL 18638708 via CL 18638715
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v899-18417669)

[CL 18638724 by ola olsson in ue5-main branch]
2022-01-18 07:54:10 -05:00
simon orr
4bfd78ee34 Moving STAT event after early return resulting in no trace events when no work is being done.
#rb Andrew.Ladenberger
[FYI] aurel.cordonnier

#ROBOMERGE-AUTHOR: simon.orr
#ROBOMERGE-SOURCE: CL 18609420 via CL 18609435 via CL 18609480 via CL 18609498 via CL 18614261 via CL 18614330 via CL 18614369
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v899-18417669)

[CL 18614399 by simon orr in ue5-main branch]
2022-01-13 22:55:03 -05:00