Commit Graph

145 Commits

Author SHA1 Message Date
jeremy moore
e85cf8e43b Use correct instance bounds for vertex factories with UBO style GPUScene.
Was using the primitive bounds instead.

[CL 28315196 by jeremy moore in ue5-main branch]
2023-09-28 08:36:19 -04:00
jamie hayes
930027ba2c Add a GPU Scene instance data flag for "Force Hidden" and use that instead of an invalid primitive ID to mark instances for cull.
This fixes issues with mobile GPU scene culling, which needs to access a valid primitive ID from forcibly culled instances' data.

#rb ola.olsson

[CL 27947310 by jamie hayes in ue5-main branch]
2023-09-16 22:04:57 -04:00
jamie hayes
4a2eaa711f Spline mesh updates:
- Add system for spline meshes to cache their slice transforms into look-up textures to optimize spline evaluations in shaders.
- Optimize the Nanite cluster culling shader with spline mesh deformation enabled to limit the cost of this shader added to all Nanite culling.
- More tightly pack the spline mesh parameters into 7 float4s from 8 and rearrange them to optimize shader access.
- Add "Nanite Cluster Bounds Scale" to spline mesh parameters as a means of fixing rare artifacts caused by inaccurate cluster culling bounds.
- A few other various tweaks and fixes to Nanite spline meshes.
- With these improvements, r.Nanite.AllowSplineMeshes is now on by default

NOTE: This is a re-submission of a change that had been previously rolled back. It is now being resubmitted with fixes to the following issues:
- Gaps in spline meshes due to calculating endpoint tangents using finite differencing of the texture.
- Fixed an issue where spline mesh deformation was broken in RVT rendering.
- Fix to an assert that would trip in some commandlets that were using the scene uniform buffer without having first initialized FSystemTextures
- Handle extrapolation of spline sampling from manually specifying mesh extents that are smaller than the actual mesh boundaries.

#rb brian.karis
#jira UE-181795

[CL 27697936 by jamie hayes in ue5-main branch]
2023-09-07 20:32:42 -04:00
dmitriy dyomin
0fdd2d15e2 Make sure we correctly setup single primitive data for "uniform view" path
[CL 27335763 by dmitriy dyomin in ue5-main branch]
2023-08-24 04:49:14 -04:00
jamie hayes
6cd9053b7c Effective backout of CL27173342 until spline mesh rendering issues can be addressed.
#jira UE-181795

#ushell-cherrypick of 27202918 by jamie.hayes

[CL 27204423 by jamie hayes in ue5-main branch]
2023-08-18 11:44:28 -04:00
jamie hayes
545fce3513 Spline mesh updates:
- Add system for spline meshes to cache their spline positions into a look-up texture to optimize spline evaluations in shaders.
- Optimize the Nanite cluster culling shader with spline mesh deformation enabled to limit the cost of this shader added to all Nanite culling.
- More tightly pack the spline mesh parameters into 7 float4s from 8 and rearrange them to optimize shader access.
- Add "Nanite Cluster Bounds Scale" to spline mesh parameters as a means of fixing rare artifacts caused by inaccurate cluster culling bounds.
- A few other various tweaks and fixes to Nanite spline meshes.
- With these improvements, r.Nanite.AllowSplineMeshes is now on by default

#rb brian.karis
[FYI] rune.stubbe, graham.wihlidal
#jira UE-181795

[CL 27187995 by jamie hayes in ue5-main branch]
2023-08-17 18:00:41 -04:00
dmitriy dyomin
c47b7259ff Fixed several issues with mobile GPUScene related to static lighting and custom per-instance data
#p4v-cherrypick 26455972, 26507060, 26507819, 26567727, 26568138

[CL 26569649 by dmitriy dyomin in ue5-main branch]
2023-07-25 08:41:54 -04:00
marc audy
1b8e7f29c4 Rework GPUScene support on mobile platforms.
Platforms that do support uniform buffer objects can now provide batched primitive data through UBO. There is a limit UBO range that can be accessed in shaders, so we group instances into batches that fit into this limit. Switch uses 64KB views, other platfroms16KB views. For each primitive we allocate 512Bytes and 256Bytes for instance. Mobile platforms that do not support UBO will use a desktop version of GPUScene.
There are a few things that still missing: Dynamic mesh passes,  static lighting
#rb ola.olsson, benjamin.rouveyrol

[CL 26354848 by marc audy in ue5-main branch]
2023-06-30 16:34:38 -04:00
yuriy odonnell
b67c4cb749 Add bSupportsVertexShaderSRVs to DataDrivenShaderPlatformInfo which drives PLATFORM_SUPPORTS_VERTEX_SHADER_SRVS shader
* This should be used to guard any features that require explicitly accessing buffer or textures SRVs in vertex shaders

#rb Dmitriy.Dyomin
#rb Kenzo.Terelst

[CL 26207274 by yuriy odonnell in ue5-main branch]
2023-06-23 05:56:06 -04:00
jamie hayes
826bda9e1b Fix mobile GPU scene shader compilation error
#jira UE-188309

[CL 25892104 by jamie hayes in ue5-main branch]
2023-06-09 10:07:01 -04:00
benjamin rouveyrol
1c00e370cc fix for primitive data in mobile preview
#jira UE-187651
#rb dmitriy.dyomin jeremy.moore florin.pascu

[CL 25872126 by benjamin rouveyrol in ue5-main branch]
2023-06-08 11:11:20 -04:00
jamie hayes
1759d9a716 - Add the ability for specialized scene proxies to add extensible data to the payload of their instances, and change spline meshes to utilize this new mechanism.
- Some refactoring of LocalVertexFactory shader code to accommodate new spline mesh changes as well as to clean it up a little.
- Split primitive flags in the GPU Scene primitive data relating to visibility out into its own to facilitate adding another flag that wouldn't fit into a single DWORD.

#rb ola.olsson

[CL 25853575 by jamie hayes in ue5-main branch]
2023-06-07 15:16:07 -04:00
Ola Olsson
b1ff38a340 Prevent instance over-allocation from crashing the editor / engine.
- Clamps the gpu-scene instance buffer size to the max supported instance ID (MAX_INSTANCE_ID, 16M at present)
 - Overflowing ID's will just result in OOB buffer accesses on the GPU which is tolerated and rendering will be undefined.
 - Added logging + on-screen message to surface the issue.

#jira UE-182255
#rb jamie.hayes
#preflight 646f7adf50786bb5ba8067b1

[CL 25622221 by Ola Olsson in ue5-main branch]
2023-05-25 11:38:31 -04:00
jamie hayes
56a34dbd05 Experimental work in progress for Nanite support of SplineMeshComponent.
#rb brian.karis
#fyi rune.stubbe, graham.wihlidal
#jira UE-181795
#preflight 646bac02b82cb3fe67620d66

[CL 25620628 by jamie hayes in ue5-main branch]
2023-05-25 10:06:57 -04:00
jamie hayes
30df0b799f More GPU Scene data code clean-up:
- Move primitive data stride to SceneDefinitions header so we don't have to change it in 3 places in code.
- Move FPrimitiveSceneShaderData to its own header to (eventually) eliminate dependencies that adversely affect compile time.
- Deprecate scatter upload buffer support for texture targets and prepare to clean up hacks that were previously done for the sake of GPU Scene that are no longer needed.

#rb ola.olsson
#preflight 644fe4750e33f2d51d787e71

[CL 25285293 by jamie hayes in ue5-main branch]
2023-05-01 12:39:32 -04:00
Ola Olsson
77d15449ac Deduplicated primitive flags to a shared header & also deduplicated shader paramter construction to shared function in the proxy.
- Also moved FPrimitiveUniformShaderParametersBuilder to its own header to cut down rebuilding when changing scene & nanite definitions.

#rb jamie.hayes
#preflight 644919d41c2846595cfdbf28

[CL 25199110 by Ola Olsson in ue5-main branch]
2023-04-26 11:26:23 -04:00
graham wihlidal
eb1b7a49f9 Implemented support for per-primitive and per-patch min/max displacement bounds (driven by material editor UX). Solves incorrect cluster culling and patch splitting (CPU padded bounds calculation needs a bit more work still).
#rb brian.karis
#fyi rune.stubbe
#preflight skip

[CL 25090196 by graham wihlidal in ue5-main branch]
2023-04-18 13:38:20 -04:00
jamie hayes
ee7a64c5b3 - Implement "WPO Disable Distance" for non-Nanite static meshes, and unify FMaterialVertexParameters.bEvaluateWorldPositionOffset for all vertex factories
- Add instance draw distance and global clip plane culling to GPU instance culling and VSM culling shaders to prevent VS invocations for invisible instances.
- Additional clean-up to GPU Scene data and culling code.

#rb ola.olsson
#preflight 640a5bf67e654e2e6543a98c

[CL 24584209 by jamie hayes in ue5-main branch]
2023-03-09 17:51:49 -05:00
jamie hayes
e54c43ad9b [Backout] - CL24579289 and CL24579327
Original CL Desc
-----------------------------------------------------------------
- Implement "WPO Disable Distance" for non-Nanite static meshes, and unify `FMaterialVertexParameters.bEvaluateWorldPositionOffset` for all vertex factories
- Add instance draw distance and global clip plane culling to GPU instance culling and VSM culling shaders to prevent VS invocations for invisible instances.
- Additional clean-up to GPU Scene data and culling code.

#rb ola.olsson
#preflight 6407c662ba12ba6416b8245b

[CL 24581209 by jamie hayes in ue5-main branch]
2023-03-09 15:30:06 -05:00
jamie hayes
7e580ef63c - Implement "WPO Disable Distance" for non-Nanite static meshes, and unify FMaterialVertexParameters.bEvaluateWorldPositionOffset for all vertex factories
- Add instance draw distance and global clip plane culling to GPU instance culling and VSM culling shaders to prevent VS invocations for invisible instances.
- Additional clean-up to GPU Scene data and culling code.

#rb ola.olsson
#preflight 6407c662ba12ba6416b8245b

[CL 24579289 by jamie hayes in ue5-main branch]
2023-03-09 13:34:35 -05:00
Wei Liu
847b2c4fd6 Support instance custom data in pixel shader with mobile GpuScene enabled.
#jira none

#rb Dmitriy.Dyomin
#preflight 63f85e32b879197e7327593e

[CL 24397271 by Wei Liu in ue5-main branch]
2023-02-24 02:05:18 -05:00
jamie hayes
14f3cf4674 Rename "Max World Position Offset Distance" to "Max World Position Offset Displacement" to avoid confusing it with "World Position Offset Disable Distance"
#rb kevin.ortegren
#jira UE-178135
#rnx
#preflight 63f4f76d977ceed915cb3d5b

[CL 24368841 by jamie hayes in ue5-main branch]
2023-02-22 16:02:48 -05:00
dmitriy dyomin
9d6f84b603 Fixed: WPO does not work on Mobile with GPUScene enabled
#jira UE-176436
#rb Jamie.Hayes
#preflight 63e4726f244dc45a202e9a70

[CL 24093356 by dmitriy dyomin in ue5-main branch]
2023-02-09 01:44:34 -05:00
jamie hayes
2da64290f7 Add MaxWorldPositionOffsetDistance to materials and use it to both clamp WorldPositionOffset to a fixed distance and to extend culling bounds of meshes (including cluster culling bounds of Nanite clusters). Also add a feature to the "Out of Bounds Pixels" visualization to highlight clamped offsets.
#rb ola.olsson, massimo.tristano
#fyi rune.stubbe, graham.wihlidal, brian.karis
#jira UE-175207
#preflight 63e281e7c2257e56f40c0b75

[CL 24051566 by jamie hayes in ue5-main branch]
2023-02-07 12:21:42 -05:00
krzysztof narkowicz
cc2e022c38 Improved Lumen Scene filtering:
* Primitives are only tracked by Lumen scene if they can be traced by the current ray tracing method. E.g. if we use HWRT then only primitives with valid BLAS will generate surface cache.
* Instead of recomputing VisibleInLumenScene on every add/remove/update this flag is now cached on proxy
* Added GPU side filtering of draws which should be skipped when capturing surface cache

#preflight 63dd8637323e7eaa30b71680
#jira UE-176073
#rb Daniel.Wright

[CL 24031439 by krzysztof narkowicz in ue5-main branch]
2023-02-06 11:19:54 -05:00