Commit Graph

115 Commits

Author SHA1 Message Date
jamie hayes
3b2a28806a Fix for spline mesh rendering bugs on mobile platforms with GPU Scene enabled.
[CL 27508763 by jamie hayes in ue5-main branch]
2023-08-30 19:49:03 -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
7915f62221 Optionally compute per-instance params (fade amount, show/hide, dither) depending on whether material actually needs it
#rb jack.porter

[CL 26800314 by dmitriy dyomin in ue5-main branch]
2023-08-03 02:27:26 -04:00
jamie hayes
8fdbe295bf New material option: "Always Evaluate World Position Offset". This new option is used to force World Position Offset to always be evaluated for a material so that it cannot be disabled by the likes of "Evaluate World Position Offset" or "World Position Offset Disable Distance" on the component. This is useful for meshes that use WPO for behavior like billboarding (i.e. imposters) where WPO shouldn't be disabled for performance.
This option has the following knock-on effects of other rendering systems to prevent potential bugs or artifacts:
* For non-Nanite meshes, enabling this option will force instances of draw commands with this material applied to always invalidate VSM page cache when instance culling for VSM shadows.
* For Nanite meshes, enabling this option will force all clusters of all instances to pad cluster culling bounds and invalidate cached VSM pages, even if clusters don't have this material applied to it, as it would be prohibitively expensive to determine if no materials on the cluster would force invalidation.

#rb ola.olsson, massimo.tristano

[CL 26456226 by jamie hayes in ue5-main branch]
2023-07-19 05:48:22 -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
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
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
Josie Yang
e37bae26ce Fix when multiple viewports are open, only the viewport in focus has valid velocity on skeletal meshes.
This is fixed by switching to use GFrameCounter which is incremented once per engine tick, so multi views of the same frame share the same value.

#jira IRON-653
#rb jason.hoerner
#preflight 646d05611b241f0748b2cb14

[CL 25617857 by Josie Yang in ue5-main branch]
2023-05-25 05:47:45 -04:00
Josie Yang
a6cf0b0c93 Fix instanced static mesh loose params warnings in debug build. Create a loose parameter uniform buffer to capture those parameters.
#jira UE-171796
#rb Massimo.Tristano
#preflight 453966c4d593c0b4276ce38

[CL 25354022 by Josie Yang in ue5-main branch]
2023-05-05 10:04:13 -04:00
carl lloyd
7a31ca4270 Enable Android Vulkan SM5 Ray Tracing
#rb jeannoe.morissette, yuriy.odonnell
#preflight 643966259566b61450eddea4

[CL 25040539 by carl lloyd in ue5-main branch]
2023-04-14 10:52:39 -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
chris kulla
b892c64160 RayTracing: Add support for SplineMesh components
This allows spline meshes to work in path tracing notably, as well as RT shadows and other raytraced effects. A new cvar "r.RayTracing.Geometry.SplineMeshes" can be used to quickly enable or disable support.

#rb Aleksander.Netzel
#jira UE-116051
#jira UE-151103
#preflight 63cc5d1ad83c1837b1b0523e

[CL 23949217 by chris kulla in ue5-main branch]
2023-02-01 11:07:02 -05:00
Jeremy Moore
7720ee7e2a Moved passthrough vertex factory previous frame logic from CPU to GPU.
This allows us to create the loose uniform buffer when we update the vertex factory instead of during the mesh batch creation.
#preflight 63a2421735203bc7aa89bd31

[CL 23552584 by Jeremy Moore in ue5-main branch]
2022-12-21 10:11:01 -05:00
Jeremy Moore
2670beb17e Optimus: Move ownership of deformed geometry out of passthrough vertex factory and into the mesh object.
This allows multiple deformers to write to different parts of the same final vertex buffer.
Simplify the passthrough vertex factory, and the logic around uniform buffer updates.
#preflight 63a09252012902cb8d22c1b7

[CL 23548650 by Jeremy Moore in ue5-main branch]
2022-12-19 13:37:37 -05:00
Dmitriy Dyomin
0d126dd50d Fixed: Missing per-instance CustomData in a pixel shaders when GPUScene is off
#jira none
#rb ola.olsson
#preflight 63525098ae33b04ec1e878b7

[CL 22685858 by Dmitriy Dyomin in ue5-main branch]
2022-10-21 04:11:02 -04:00
josie yang
270bbc6c98 Create loose parameters uniform buffer to encapsulate GPUSkinPassThroughVertexFactory PreviousPositionBuffer.
Fixes ensure failure in MessPassProcessor.cpp in debug_editor build, due to PreviousPositionBuffer being a loose SRV parameter.

#jira UE-165128
#rb Massimo.Tristano
#preflight 634408ea360ee7edeafdd5d7
#lockdown juan.canada

[CL 22431615 by josie yang in ue5-main branch]
2022-10-10 12:18:34 -04:00
jonathan bard
e3aeb389f5 * Bumped GUID in ShaderVersion.ush to fix shader invalidation issue on all platforms (similar to 22136421), which generates crashes on load for several users
* Fixed warning when compiling materials with instancing

#rnx
[FYI] mihnea.balta
#rb laura.hermanns

[CL 22151217 by jonathan bard in ue5-main branch]
2022-09-22 22:22:00 -04:00
josie yang
54b7792ae0 Fix skeletal mesh previous frame local-to-translated-world position in large world coordinates for both GPUSkinVF and LocalVF PassThrough.
#jira UE-155378
#rb Massimo.Tristano
#preflight 632c60bad51603c5483bdf71

[CL 22145865 by josie yang in ue5-main branch]
2022-09-22 17:38:41 -04:00
chris kulla
7e3c9ba2ee Add support for per instance random in ray tracing shaders and the path tracer
The logic for fetching RandomID from instances was only active when instancing was setup for the vertex factory, which is not the case for raytracing (which handles instancing natively). I followed the pattern used for per instance custom data which was already supported. Since the per instance random value is constant per primitive, I simplified the logic and moved it out of the interpolated quantity PerInstanceParams (which is now a float3 instead of a float4).

Tweaked the logic that enables the RandomID field to only populate it when either PerInstanceRandom or dither fade is enabled (which are the only two cases that use it currently).

#jira UE-163215
#rb Yuriy.ODonnell,Graham.Wihlidal
#preflight 63223eb58838676d105e2d92

[CL 22016969 by chris kulla in ue5-main branch]
2022-09-14 17:20:41 -04:00
josie yang
0c0faf15f5 Fix a couple issues introduced by CL21962580 "Reduce GPUSkinPassThrough vertex factory shader permuations by merging it into local vertex factory."
Issue 1: unbound parameters errors when `r.ShaderDevelopmentMode=1` launching EngineTest
Issue 2: Debug editor build Ensure condition failed in MeshPassProcesser.cpp shader with vertex factory FLocalVertexFactory never set texture at BaseIndex6

#jira UE-157662
#rb jason.nadro
#preflight 6321e1dd9677b738f4ecbb6f

[CL 22009358 by josie yang in ue5-main branch]
2022-09-14 12:31:18 -04:00
josie yang
0adae50d01 Reduce GPUSkinPassThrough vertex factory shader permuations by merging it into local vertex factory. PassThroughVF is kept as a wrapper class.
CitySample PC cook stats (recompile all shaders in both runs):
Baseline: 75229 shaders compiled, Cook time 1h35m46s
WithChange: 69228 shaders compiled, Cook time 1h29m10s
Shader reduction 8%, Cook time reduction 6mins

#jira UE-157662
#rb jason.nadro, jeremy.moore, dmitriy.dyomin
#preflight 631f0e5298092524abfb6044

[CL 21971450 by josie yang in ue5-main branch]
2022-09-12 16:09:37 -04:00
Yuriy ODonnell
bb79c33a70 Avoid calling GetPrimitiveData() redundantly. This function is large inlining and contributes significantly to the shader compilation cost.
#rb Ola.Olsson
#preflight skip

[CL 21898715 by Yuriy ODonnell in ue5-main branch]
2022-09-08 14:20:54 -04:00