Commit Graph

105 Commits

Author SHA1 Message Date
Jason Nadro
fc3dcee397 Restore backed out CL, with fixes.
Also restores follow-up CLs 19973746, 19973782
FStaticParameterSet::MaterialLayers can't be deprecated, since a property with the same name is included via FStaticParameterSetRuntimeData
So instead, FMaterialLayersFunctionsRuntimeData is updated with SerializeFromMismatchedTag, to allow serializing a full FMaterialLayersFunction.
When this happens, the EditorOnly portion is stored in a separate heap allocation, and then transferred to FStaticParameterSet::EditorOnly::MaterialLayers
#preflight 626c3405e31dbb512cef1e98

[Backout] - CL19973745
#fyi bob.tellez
Original CL Desc
-----------------------------------------------------------------
[Backout] - CL19964485
#fyi Ben.Ingram
Original CL Desc
-----------------------------------------------------------------
Add 'Optional' EditorOnly data for UMaterialInterface and UMaterialFunctionInterface
These are separate UObject hierarchies that store editor-only UPROPERTIES, but can be included with cooked content, which allows full editor support.
In principle, all editor-only properties could be moved over.  So far, this has been limited to UMaterialExpressions, and data related to material parameters.
FStaticParameterSet, FMaterialLayersParameters, and FMaterialCachedExpressionData have all been split into separate editor-only/non-editor-only classes,
which allows the editor-only portion to be stored on the optional editor-only UObject.
#preflight 626ab21dad56c0cbbea32dc4
#rb jason.nadro, francis.hurteau
#jira FORT-463329

[CL 20043286 by Jason Nadro in ue5-main branch]
2022-05-04 12:21:52 -04:00
bob tellez
34d8d5badd [Backout] - CL19964485
#fyi Ben.Ingram
Original CL Desc
-----------------------------------------------------------------
Add 'Optional' EditorOnly data for UMaterialInterface and UMaterialFunctionInterface
These are separate UObject hierarchies that store editor-only UPROPERTIES, but can be included with cooked content, which allows full editor support.
In principle, all editor-only properties could be moved over.  So far, this has been limited to UMaterialExpressions, and data related to material parameters.
FStaticParameterSet, FMaterialLayersParameters, and FMaterialCachedExpressionData have all been split into separate editor-only/non-editor-only classes,
which allows the editor-only portion to be stored on the optional editor-only UObject.
#preflight 626ab21dad56c0cbbea32dc4
#rb jason.nadro, francis.hurteau
#jira FORT-463329

[CL 19973745 by bob tellez in ue5-main branch]
2022-04-28 20:08:12 -04:00
Ben Ingram
448b0a9807 Add 'Optional' EditorOnly data for UMaterialInterface and UMaterialFunctionInterface
These are separate UObject hierarchies that store editor-only UPROPERTIES, but can be included with cooked content, which allows full editor support.
In principle, all editor-only properties could be moved over.  So far, this has been limited to UMaterialExpressions, and data related to material parameters.
FStaticParameterSet, FMaterialLayersParameters, and FMaterialCachedExpressionData have all been split into separate editor-only/non-editor-only classes,
which allows the editor-only portion to be stored on the optional editor-only UObject.
#preflight 626ab21dad56c0cbbea32dc4
#rb jason.nadro, francis.hurteau
#jira FORT-463329

[CL 19964485 by Ben Ingram in ue5-main branch]
2022-04-28 12:56:28 -04:00
aurel cordonnier
fc542f6cfd Merge from Release-Engine-Staging @ 18081189 to Release-Engine-Test
This represents UE4/Main @18073326, Release-5.0 @18081140 and Dev-PerfTest @18045971

[CL 18081471 by aurel cordonnier in ue5-release-engine-test branch]
2021-11-07 23:43:01 -05:00
kevin ortegren
7bf79cbec3 [Backout] - CL17887288
[FYI] Ben.Ingram
#jira UE-132661
Original CL Desc
-----------------------------------------------------------------
Generate cached data for MID created at runtime in non-editor builds
Make sure material instance resources are updated from cached data loaded in non-editor builds
#jira UE-131802
#rb none

#ROBOMERGE-OWNER: aurel.cordonnier
#ROBOMERGE-AUTHOR: kevin.ortegren
#ROBOMERGE-COMMAND: _robomerge UE5-Release-Engine-Test
#ROBOMERGE-SOURCE: CL 17921250 in //UE5/Release-5.0/... via CL 17922774
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v885-17909292)

[CL 17930569 by kevin ortegren in ue5-release-engine-test branch]
2021-10-26 14:27:07 -04:00
aurel cordonnier
a6e741e007 Merge from Release-Engine-Staging @ 17915896 to Release-Engine-Test
This represents UE4/Main @17911760, Release-5.0 @17915875 and Dev-PerfTest @17914035

[CL 17918595 by aurel cordonnier in ue5-release-engine-test branch]
2021-10-25 20:05:28 -04:00
ben ingram
0bb0a923a0 Merging Dev-LWCRendering into Main, this includes initial work to support rendering with LWC-scale position
Basic approach is to add HLSL types FLWCScalar, FLWCMatrix, FLWCVector, etc.  Inside shaders, absolute world space position values should be represented as FLWCVector3.  Matrices that transform *into* absolute world space become FLWCMatrix.  Matrices that transform *from* world space become FLWCInverseMatrix.  Generally LWC values work by extending the regular 'float' value with an additional tile coordinate.  Final tile size will be a trade-off between scale/accuracy; I'm using 256k for now, but may need to be adjusted.  Value represented by a FLWCVector thus becomes V.Tile * TileSize + V.Offset.  Most operations can be performed directly on LWC values.  There are HLSL functions like LWCAdd, LWCSub, LWCMultiply, LWCDivide (operator overloading would be really nice here).  The goal is to stay with LWC values for as long as needed, then convert to regular float values when possible.  One thing that comes up a lot is working in translated (rather than absolute) world space.  WorldSpace + View.PrevPreViewTranslation = TranslatedWorldspace.  Except 'View.PrevPreViewTranslation' is now a FLWCVector3, and WorldSpace quantities should be as well.  So that becomes LWCAdd(WorldSpace, View.PrevPreViewTranslation) = TranslatedWorldspace.  Assuming that we're talking about a position that's "reasonably close" to the camera, it should be safe to convert the translated WS value to float.  The 'tile' coordinate of the 2 LWC values should cancel out when added together in this case.  I've done some work throughout the shader code to do this.  Materials are fully supporting LWC-values as well.  Projective texturing and vertex animation materials that I've tested work correctly even when positioned "far away" from the origin.

Lots of work remains to fully convert all of our shader code.  There's a function LWCHackToFloat(), which is a simple wrapper for LWCToFloat().  The idea of HackToFloat is to mark places that need further attention, where I'm simply converting absolute WS positions to float, to get shaders to compile.  Shaders converted in this way should continue to work for all existing content (without LWC-scale values), but they will break if positions get too large.

General overview of changed files:
LargeWorldCoordinates.ush - This defines the FLWC types and operations
GPUScene.cpp, SceneData.ush - Primitives add an extra 'float3' tile coordinate.  Instance data is unchanged, so instances need to stay within single-precision range of the primitive origin.  Could potentially split instances behind the scenes (I think) if we don't want this limitation
HLSLMaterialDerivativeAutogen.cpp, HLSLMaterialTranslator.cpp, Preshader.cpp - Translated materials to use LWC values
SceneView.cpp, SceneRelativeViewMatrices.cpp, ShaderCompiler.cpp, InstancedStereo.ush - View uniform buffer includes LWC values where appropriate
#jira UE-117101
#rb arne.schober, Michael.Galetzka

#ROBOMERGE-AUTHOR: ben.ingram
#ROBOMERGE-SOURCE: CL 17787435 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v881-17767770)

[CL 17787478 by ben ingram in ue5-release-engine-test branch]
2021-10-12 13:31:00 -04:00
ben ingram
b1e9eabace Clean up clearing material parameters when copying back from PreviewMaterial. Fixes static parameters not properly copying back (since the runtime impl of those also includes an override flag)
#rb none
#jira none

#ROBOMERGE-AUTHOR: ben.ingram
#ROBOMERGE-SOURCE: CL 17603418 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v871-17566257)

[CL 17603426 by ben ingram in ue5-release-engine-test branch]
2021-09-22 21:37:09 -04:00
ben ingram
cc1ca5cacb When modifying parameter value on a UMaterial, update all expressions that match the name, rather than simply the first
#rb none
#jira UE-126954

#ROBOMERGE-AUTHOR: ben.ingram
#ROBOMERGE-SOURCE: CL 17598789 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v871-17566257)

[CL 17598801 by ben ingram in ue5-release-engine-test branch]
2021-09-22 15:00:15 -04:00
ben ingram
851db3b214 Extend FMaterialParameterMetadata with Group, SortPriority, and Description. Cache this data inside FMaterialCachedData.
UMaterialInterface methods to query this data become non-virtual, instead it's just returned along with other Metadata when accessing the parameter value
Remove parameter group caching mechanism inside PreviewMaterial.cpp; no longer needed since group lookup now comes "for free" along with other relevant parameter data
#jira none
#rb zousar.shaker

#ROBOMERGE-AUTHOR: ben.ingram
#ROBOMERGE-SOURCE: CL 17596225 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v871-17566257)

[CL 17596251 by ben ingram in ue5-release-engine-test branch]
2021-09-22 11:34:20 -04:00
ben ingram
d4e0953afb Refactor/cleanup surrounding material parameters.
Primary goal is to reduce amount of code duplicated across different parameter types, and reduce amount of boilerplate required to add new parameters
The main part are new types FMaterialParameterValue, and FMaterialParameterMetadata (both in MaterialTypes.h).  FMaterialParameterValue is a tagged union/variant type, that can represent any material parameter value.  FMaterialParameterMetadata contains a value, along with various editor-only fields that describe how that value is used.
Using this new type, many places that previously included separate APIs for each parameter type collapse to a single API that operates on a FMaterialParameterValue/FMaterialParameterMetadata.  Code that previously had a block copy/pasted for each parameter type can be replaced with a loop that iterates over all parameter types.
Also includes some API cleanup that should improve (editor) performance.  Previously we had APIs GetAllScalarParameters, GetAllVectorParameters, etc, which would return a list of FMaterialParameterInfos for each parameter of the given type.  Code would often query all parameters, then loop over the results and lookup each parameter value.  Now there's a new API, GetAllParametersOfType, which returns a list of all FMaterialParameterMetadata of a given type.  It's easy to just collect the values at the time we're building the list of parameters, so this saves the work of looking up each value individually.
#jira none
#rb lauren.barnes
[FYI] zousar.shaker

#ROBOMERGE-SOURCE: CL 17360722 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)

[CL 17360730 by ben ingram in ue5-release-engine-test branch]
2021-08-30 18:53:14 -04:00
aurel cordonnier
25a11deeac Merge from Release-Engine-Staging @ 16579919
This represents UE4/Main @ 16579691 and Dev-PerfTest @ 16579576

[CL 16581170 by aurel cordonnier in ue5-release-engine-test branch]
2021-06-07 20:09:45 -04:00
ben ingram
96be34fb82 Allow 'Output Translucent Velocity' to be overriden by material instances
#jira FROST-2607
#rb arciel.rekman, jason.nadro

#ROBOMERGE-SOURCE: CL 16316954 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v804-16311228)

[CL 16316976 by ben ingram in ue5-release-engine-test branch]
2021-05-13 15:29:02 -04:00
arciel rekman
cad5894dcc Fix bIsPersistent not being propagated properly (UE-110824)
- Log more information about the material DDC.
- Also removed some leftover code that wasn't necessary.

#rb Ben.Ingram, Jason.Nadro
[REVIEW] [at]Ben.Ingram, [at]Jason.Nadro
#jira UE-110824

#ROBOMERGE-SOURCE: CL 15785428 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v783-15756269)

[CL 15790716 by arciel rekman in ue5-main branch]
2021-03-23 22:41:51 -04:00
Francis Hurteau
f478020e75 Edigrate cl 15621005:
Fix nullptr crash when caching material parameter data on attribute layers

#rb trivial
#jira FROST-1412

[CL 15737395 by Francis Hurteau in ue5-main branch]
2021-03-18 09:41:43 -04:00
Marc Audy
8f73cd7fa9 Merge UE5/Release-Engine-Staging @ 15630841 to UE5/Main
This represents UE4/Main @ 15601601

[CL 15631170 by Marc Audy in ue5-main branch]
2021-03-05 19:27:14 -04:00
Zousar Shaker
a160958acf Prototype Wrapped Object Pointers (ObjectHandle/ObjectPtr)
Avoiding use of implicit conversion to pointer reference on TObjectPtr (making it either explicit or using a reference to a TObjectPtr where that is an easy option).

#rb matt.peters

[CL 14840803 by Zousar Shaker in ue5-main branch]
2020-12-02 20:23:02 -04:00
Marc Audy
4c1bb11c29 Merge UE5/Release-Engine-Staging to UE5/Main @ 14548662
This represents UE4/Main @ 14525125 + cherrypicked fixes
#skipundocheck

[CL 14551026 by Marc Audy in ue5-main branch]
2020-10-22 19:19:16 -04:00
Marcus Wassmer
3b81cf8201 Merging using //UE5/Main_to_//UE5/Release-Engine-Staging @14384769
autoresolved files
#rb none

[CL 14384911 by Marcus Wassmer in ue5-main branch]
2020-09-24 00:43:27 -04:00
Marc Audy
a7c9001a94 Merging //UE5/Release-Engine-Staging to Main (//UE5/Main) @ 14075166
#rb
#rnx

[CL 14075271 by Marc Audy in ue5-main branch]
2020-08-11 01:36:57 -04:00
Michal Valient
95d19f95b1 [REVERB] Merging //UE4/Private-Reverb-Development@13832732
#rb graham.wihlidal, rune.stubbe, brian.karis, andrew.lauritzen, jeff.farris

[CL 13834854 by Michal Valient in ue5-main branch]
2020-07-06 18:58:26 -04:00
bob tellez
136ec97806 #UE4 Material and MaterialInstance editors now reports the temporary top level preview objects they spawn to the asset toolkit so external code can see them (useful in property editor code, since users are editing the preview objects, not the real ones). Also made the objects in RegenerateArrays children of the object they are spawned for, also for discovery reasons.
#jira UE-91182

#ROBOMERGE-SOURCE: CL 12465625 via CL 12465718 via CL 12467508 via CL 12467676
#ROBOMERGE-BOT: RELEASE (Release-Engine-Staging -> Main) (v672-12450963)

[CL 12467769 by bob tellez in Main branch]
2020-03-27 10:59:17 -04:00
Ben Ingram
1d49fb1237 Update cached parameters, avoid failed check when modify MI layer asset
#rb none

[CL 11308281 by Ben Ingram in Main branch]
2020-02-10 14:24:23 -05:00
Ben Ingram
719d5defd8 Update cached material data earlier, fixes failed check() when renaming parameters
#rb none

[CL 11299149 by Ben Ingram in Main branch]
2020-02-07 20:17:09 -05:00
Josh Adams
aa9705149b Copying Private-LoadTimes-4.24 stream to Main. Biggest changes are in Materials/Shader memory freezing.
#rb none

[CL 11282608 by Josh Adams in Main branch]
2020-02-06 13:13:41 -05:00