355 Commits

Author SHA1 Message Date
jian ru
04c159beb8 New material HLSL translator fixes:
- Material property output activeness is now deferred. Previously, it was checked during tree generation. It needs to be deferred because the tree is shared between a base material and its instances. An inactive property in base can be active in an instance.
- For FExpressionSetStructField, do not generate a previous frame field expression if the field isn't requested.
- Implemented GenerateHLSLExpression for UMaterialExpressionVolumetricCloudEmptySpaceSkippingInput and UMaterialExpressionVolumetricCloudEmptySpaceSkippingOutput.
- Fallback to preview values (if allowed) for material function inputs connected to invalid reroute nodes.
- FExpressionTextureSample now falls back to hardware derivatives if analytic derivatives fail to prepare.
- Added virtual function GetPreviewExpression to FExpression. Some expressions don't have numeric values and cannot be previewed directly. Those expressions should override this virtual function to return numeric preview expressions that represent their preview values. Also implemented the virtual function for FExpressionParameter.
- Added SeenStaticParameterValues to FEmitContext. For some reasons, users can create static parameter nodes with the same name but different default values. Use the first default value seen to keep things consistent.
- FMaterialResource::HasVertexPositionOffsetConnected() now queries cached expression data instead of the base material because the answer can change in instances.

#rb tom.holmes
[FYI] tom.holmes, jason.nadro, danny.kabrane, massimo.tristano

[CL 30770932 by jian ru in ue5-main branch]
2024-01-22 09:29:18 -05:00
dmytro ivanov
8287cf4cdb Option to force always compiling materials for mobile in material editor
#rb Jack.Porter

[CL 30660119 by dmytro ivanov in ue5-main branch]
2024-01-17 11:31:40 -05:00
tim doerries
e5e124fe10 Implemented the same material graph node context menu actions for SparseVolumeTexture nodes as for regular Texture nodes. This now allows to convert between Sample, Object and Parameter nodes exactly the same as with regular textures. Also fixed the graph node title bar color being different to regular texture nodes.
#rb Patrick.Kelly
#jira UE-203979
#rnx

[CL 30632415 by tim doerries in ue5-main branch]
2024-01-16 09:24:04 -05:00
brian chrisman
e808cc720f Fix audio clock source dialog not suppressing when user selects 'no' when dismissing dialog.
#rb brooke.hubert, Max.Chen

[CL 30418742 by brian chrisman in ue5-main branch]
2023-12-20 14:39:46 -05:00
massimo tristano
724400d3d9 Material Editor - Made material translation DDC query async to material translation (running at the same time), so that the process that completes first will be used instead of doing them both serially.
#rb dan.elksnitis, rob.krajcarski
#jira UE-193797

[CL 30178621 by massimo tristano in ue5-main branch]
2023-12-07 09:23:09 -05:00
massimo tristano
b62e5dc336 [Backout] - CL30112943
[FYI] massimo.tristano
Original CL Desc
-----------------------------------------------------------------
Material Editor - Made material translation DDC query async to material translation (running at the same time), so that the process that completes first will be used instead of doing them both serially.

#rb dan.elksnitis
#jira UE-193797

[CL 30121479 by massimo tristano in ue5-main branch]
2023-12-05 11:54:35 -05:00
massimo tristano
63e6b14b6c Material Editor - Made material translation DDC query async to material translation (running at the same time), so that the process that completes first will be used instead of doing them both serially.
#rb dan.elksnitis
#jira UE-193797

[CL 30113016 by massimo tristano in ue5-main branch]
2023-12-05 07:24:32 -05:00
jason hoerner
14b74f7fa9 Material Editor: Added statistics for preshaders, and dumping of preshader expressions and parameter fetches in human readable form to the HLSL source. Similar statistics had been implemented in debug code to optimize a worst case shader, but now they are user facing to allow anyone to do similar content optimizations.
#jira UE-198495
#rb massimo.tristano

[CL 29857899 by jason hoerner in ue5-main branch]
2023-11-20 20:34:05 -05:00
marc audy
59f0feb3e4 Fix warning V595: The pointer was utilized before it was verified against nullptr.
#rnx

[CL 29459035 by marc audy in ue5-main branch]
2023-11-04 01:30:32 -04:00
sameer mirza
2d63804d3f Material Root node inline control updates
#jira UE-160029
#rb massimo.tristano

[CL 28924679 by sameer mirza in ue5-main branch]
2023-10-19 13:19:25 -04:00
dmytro ivanov
29dc070c2d Report issues in base material for shader platforms not covered by current RHI feature levels.
#rb Jack.Porter

[CL 28658986 by dmytro ivanov in ue5-main branch]
2023-10-11 07:36:26 -04:00
sameer mirza
7e5d316534 Fix "Promote to Variable" in Root node pins only creating Vector nodes.
#jira UE-160029
#rb Jason.Nadro

[CL 28540497 by sameer mirza in ue5-main branch]
2023-10-06 10:53:19 -04:00
dmytro ivanov
253f2b03a5 Improve platform stats and material editor compilation warnings.
#rb Jack.Porter

[CL 28382284 by dmytro ivanov in ue5-main branch]
2023-10-02 12:31:34 -04:00
charles derousiers
7a8788dd6f Fix material function crash with Substrate on preview.
There were two issues:
* The material function preview was not correctly converting material attribute output.
* The cached expression were not populated, causing the IsMaterialAttributeOutput() function to not return the correct value.

Down the line, this was causing material attribute data to be connected to a float3 input causing a crash down the line.

#rb none
[FYI] sebastien.hillaire, massimo.tristano

[CL 28180761 by charles derousiers in ue5-main branch]
2023-09-25 03:14:01 -04:00
jason nadro
bbe8eb58e0 Fix for conflicting localization messages with material editor errors.
- Warning_CompileErrorsInMaterial was used twice for two different error messages.
- Renamed the second one to Warning_CompileErrorsInMaterialInstance, since it was an error message specific to material instances.

#rb Jon.Cain
#jira UE-195762

[CL 28033767 by jason nadro in ue5-main branch]
2023-09-20 09:38:01 -04:00
dmytro ivanov
9dba280cc1 Show material hierarchy in platform stats and warn if derived material instances fail to compile
#rb Jack.Porter

[CL 27909604 by dmytro ivanov in ue5-main branch]
2023-09-15 05:04:46 -04:00
sebastien hillaire
fc45c02460 Substrate - renaming - renamed to MCT_Substrate
#rb charles.derousiers

[CL 27593807 by sebastien hillaire in ue5-main branch]
2023-09-05 08:51:11 -04:00
marc audy
65de35fdfb Lof elements that were not renamed yet.
- MSM_Substrate
- MCT_Substrate
- FStrataMaterialInput

#rb charles.derousiers

[CL 27563163 by marc audy in ue5-main branch]
2023-09-01 15:06:19 -04:00
sebastien hillaire
eff56c2a11 Substrate - Renaming - Strata class redirection to Substrate class.
#rb none
[FYI] charles.derousiers

[CL 27518277 by sebastien hillaire in ue5-main branch]
2023-08-31 07:55:22 -04:00
charles derousiers
195d4a8fe8 * Fix Substrate colored connection on input
* Add colored pin for Substrate data flow

#rb none
[FYI] sebastien.hillaire

[CL 27515051 by charles derousiers in ue5-main branch]
2023-08-31 04:49:11 -04:00
sebastien hillaire
b7f8af4297 Substrate - Rename/move file(s)
#rb none
[FYI] charles.derousiers

[CL 27515000 by sebastien hillaire in ue5-main branch]
2023-08-31 04:48:07 -04:00
sebastien hillaire
4f274d1ef3 Substrate - Rename/move file(s)
#rb none
[FYI] charles.derousiers

[CL 27514986 by sebastien hillaire in ue5-main branch]
2023-08-31 04:47:50 -04:00
charles derousiers
fc598811b5 Add color Substrate wire.
#rb none
[FYI] sebastien.hillaire

[CL 27514913 by charles derousiers in ue5-main branch]
2023-08-31 04:46:18 -04:00
charles lefebvre
a7e99ef2cb Fix bad cast in MaterialEditor.cpp
#rb daren.cheng
#rnx

[CL 27322331 by charles lefebvre in ue5-main branch]
2023-08-23 17:30:49 -04:00
luc rosenzweig
c9eb19e6cd This changelist contains both a refactor of the material graph system, as well as an improved custom HLSL node.
The first series of changes relate to modifying the way that SGraphNode* inheritants are created. Previously, NodeFactory was responsible of creating the SGraphNode* inheritants based on some runtime type checking (which basically means a series of if statements checking if the passed in pointer is of a certain child class type). Now, the UMaterialGraph* inheritants (the controller classes in the MVC paradigm of the material graph) are responsible for creating their own UI components (SGraphNode* inheritants). This just means that we now polymorphically create the proper SGraphNode* for the given UMaterialGraph* inheritant.

This refactor allows us to more flexibly create a variety of nodes types instead of relying on SGraphNodeMaterialBase as a one size fits all solution, leading to the new HLSL custom node. Previously, this node didn't support showing the syntax-highlighted code inline in the node itself. Because we now use polymorphism to create the nodes, it was very easy to create new UMaterialGraph* and SGraphNode* inheritants to support this new change.

Other changes which relate to propagating changes (to affect previews) in MaterialGraphNode.cpp are needed because there previously wasn't the mechanism to do so (which may have been a bug). For instance, suppose you had a constant vector3 feeding into a custom HLSL node which just outputs the color coming from that constant vector3 node. It would be obvious that changing the vector3, requires a preview update of the HLSL node. However, that wouldn't happen - the preview on the HLSL node just stayed the same. These changes addresses that issue.

There is one last series of changes which relates to collapsing the HLSL code in the node. We want to make sure that this change doesn't mess up the layouts of artists' already made material graphs which use the custom HLSL node. In order to address this, we added the ability to collapse the code in order to hide it. Furthermore, we had to make sure that projects which previously used a custom HLSL node, have the code collapsed by default (because it wasn't there before). However, creating a new HLSL node once this change comes in, would yield an uncollapsed node. The collapsing of nodes uses the "Advanced Pins" chevron/collapser which doesn't save its state after saving and exiting the material. It was crucial, in order to preserve the layout of the material graph, that the saving happens. However, previously, the only way to save state, was to go through a recompile/regeneration of the previews. Therefore, it was necessary to add a special function in the material editor utilities which would just mark the material as dirty such that states like whether the code was collapsed save throughout sessions.

#jira UE-146779
#rb jason.nadro

[CL 26677757 by luc rosenzweig in ue5-main branch]
2023-07-28 13:01:00 -04:00