Commit Graph

17 Commits

Author SHA1 Message Date
Charles deRousiers
338b5c153b Merge BlendMode and BlendModeStrata to reduce code divergence, and ease maintenance.
#rb sebastien.hillaire
#jira none
#preflight 63c03173c77f50e3b47ed2bd

[CL 23683231 by Charles deRousiers in ue5-main branch]
2023-01-13 14:19:13 -05:00
Charles deRousiers
d5a07828ed Fix even more Strata blend mode.
#rb none
#jira none
#preflight 639a1ee98c64c74ac80ff657

[CL 23516373 by Charles deRousiers in ue5-main branch]
2022-12-14 14:47:58 -05:00
Charles deRousiers
5c44593f0d Abstract blendmode lookup to ease blend mode compatibility with Strata.
#rb sebastien.hillaire
#jira none
#preflight 6398964335203bc7aa695e10

[CL 23492252 by Charles deRousiers in ue5-main branch]
2022-12-13 10:44:43 -05:00
christopher waters
59ca6eac55 Adding implicit includes for upcoming dependency cleanup.
#preflight 63979d4e35203bc7aa1ab3a0

[CL 23485362 by christopher waters in ue5-main branch]
2022-12-12 19:33:55 -05:00
tiago costa
7249bee912 Fix issue causing incorrect Mesh SDF generation
- Workaround issue with compiler optimization by using copy constructor.

#rb none
#preflight none
#fyi krzysztof.narkowicz

[CL 23313007 by tiago costa in ue5-main branch]
2022-11-29 12:53:43 -05:00
krzysztof narkowicz
a6c98502ff Lumen Mesh Cards - fixed infinite loop when generating mesh cards for large meshes and EmbreeRay.ray.tfar + 0.01f was equal to EmbreeRay.ray.tfar. Now hits against previous primitive are ignored and ray is always advanced by a smallest possible increment.
[CL 22221700 by krzysztof narkowicz in ue5-main branch]
2022-09-28 10:18:58 -04:00
UnrealBot
73409369c0 Branch snapshot for CL 21319338
[CL 21319338 in ue5-main branch]
2022-08-10 16:03:37 +00:00
tiago costa
66a1ac1125 Updated MeshUtilities::GenerateStratifiedUniformHemisphereSamples to use concentric disk sampling.
- The number of samples returned is the square number closer to the requested number.
- Updated code paths using the function to request a number of samples close to what they previously got.

#rb Krzysztof.Narkowicz
#preflight 628de9e7f622d972b5732cbb

#ROBOMERGE-AUTHOR: tiago.costa
#ROBOMERGE-SOURCE: CL 20361675 via CL 20361695 via CL 20361702
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v948-20297126)

[CL 20362041 by tiago costa in ue5-main branch]
2022-05-25 06:17:20 -04:00
krzysztof narkowicz
67827c332c Lumen - fixed surface coverage on sparse trees
* Mostly two sided meshes are assumed to be foliage and forced to be repsented as a cube projection
* Lowered card min density treshold for cube projections

[FYI] Daniel.Wright

#ROBOMERGE-AUTHOR: krzysztof.narkowicz
#ROBOMERGE-SOURCE: CL 19424752 via CL 19424760
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v930-19419903)

[CL 19425489 by krzysztof narkowicz in ue5-main branch]
2022-03-17 15:54:43 -04:00
daniel wright
05e0e5f329 'Affect Distance Field Lighting' per Static Mesh Section
* Useful to hide window frames in the distance field to work around over-occlusion

#ROBOMERGE-AUTHOR: daniel.wright
#ROBOMERGE-SOURCE: CL 19416394 via CL 19416400
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v928-19376421)

[CL 19417073 by daniel wright in ue5-main branch]
2022-03-16 23:42:08 -04:00
zak middleton
36c99f6887 #ue5 - LWC: FVector4f <-> FVector4d conversion is now explicit.
FLinearColor has also been modified to make any double->float conversions explicit. Previously all 3D TVector versions were allowed to be implicit and thus could convert TVector<double> => FLinearColor => TVector4<float>.

Fixed up all engine and game casts. Added "//LWC_TODO: precision loss" around any explicit casts that previously were silently explicit and we may need to revisit for precision loss analysis.

#jira UE-122085
#rb Ben.Ingram, Andrew.Davidson
#preflight 61f24af473238441cb7bb0f1

#ROBOMERGE-AUTHOR: zak.middleton
#ROBOMERGE-SOURCE: CL 18751249 in //UE5/Release-5.0/... via CL 18751253 via CL 18751319
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18751326 by zak middleton in ue5-main branch]
2022-01-27 03:30:41 -05:00
aurel cordonnier
34f55d3a4a Merge from Release-Engine-Test @ 17946149 to UE5/Main
This represents UE4/Main @17911760, Release-5.0 @17915875 and Dev-PerfTest @17914035

[CL 17949667 by aurel cordonnier in ue5-main branch]
2021-10-27 15:14:40 -04:00
krzysztof narkowicz
eed0fc3bed New Lumen surface cache card generation:
* Generate surfels directly from the triangles instead of relying on ray tracing, to fix coverage issues on some meshes
* Surfels which are inside meshes (surrounded by back faces) or are too close to geometry are discarded
* New surfel clustering algorithm, which inserts one seed after another and tries to iteratively grow clusters in order to find the best set of seeds. Final step is to reset all clusters and grow all simultaneously from previously selected seeds.
* Cluster growing is based on normal, distance and surfel visibility (don�t cluster surfels near geometry first, as it can cause algorithm to be stuck in a local minimum)
* Runtime sampling has strict culling based on the angle and card AABB. Additionally, the tri-planar blending zone was tightened. This improves performance. 0.62-0.5 ms.
* Added various visualizations and CVars for card generation debugging
* Fixed card visibility bug, where card could influence outside of it�s range due to negative shadow map visibility

[FYI] Daniel.Wright, Patrick.Kelly


#ROBOMERGE-SOURCE: CL 16897632
#ROBOMERGE-BOT: (v836-16769935)

[CL 16916104 by krzysztof narkowicz in ue5-main branch]
2021-07-21 17:57:42 -04:00
Matt Peters
bb929fe736 #jira UE-116728
Workaround embree reading 4 bytes off the end of the shared vertex array.
#b Juan.Canada
#rnx

[CL 16673542 by Matt Peters in ue5-main branch]
2021-06-15 10:45:45 -04:00
Ben Ingram
b569c9be59 Fix usage of embree with LWC for mesh distance fields and cards
#jira UE-117476
#rb Krzysztof.Narkowicz

[CL 16624221 by Ben Ingram in ue5-main branch]
2021-06-10 11:46:03 -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
Krzysztof Narkowicz
6c573a2474 Lumen surface cache now supports internal surfaces
* r.LumenScene.MeshCardsMaxLOD controls representation quality. With 0 being a box projection
* New card placement to focus on important parts of a mesh (skip non visible parts)
* Replaced CubeMapTrees with MeshCards. Instead of a big volume texture lookup there are now 6 lists of decals (one per axis)
* Merged distance field and mesh card Embree setup code into a set of common functions
* Removed hardcoded limits of 6 cards per mesh

#fyi Daniel.Wright, Patrick.Kelly, Yuriy.ODonnell

[CL 15144947 by Krzysztof Narkowicz in ue5-main branch]
2021-01-20 11:34:55 -04:00