Commit Graph

187 Commits

Author SHA1 Message Date
aidin abedi
eaeafb13bf Fix material baking incorrectly ignoring specific UV space when using mesh data
#jira UE-183148
#review @JeanLuc.Corenthin @Jason.Nadro @Kevin.Ortegren
#preflight 64370c8a00398d6f886f19f1

[CL 25014983 by aidin abedi in ue5-main branch]
2023-04-12 16:27:33 -04:00
graham wihlidal
e1db51128e Nanite (WIP) scalar displacement UX support in material editor.
#rb jason.nadro, arciel.rekman, brian.karis
#preflight 6435a2e7127980724bfb7e4e

[CL 24997884 by graham wihlidal in ue5-main branch]
2023-04-11 16:48:54 -04:00
sebastien lussier
daa2f8be29 Material Baking - Made baking more resilient to materials that output none of the requested properties (diffuse, normal, etc)
#rb philippe.deseve

[CL 24542666 by sebastien lussier in ue5-main branch]
2023-03-07 12:25:14 -05:00
sebastien lussier
25d57df2f5 Material Baking - Fix incorrect use of ProcessEmissiveOutput()
* Pitch in is pixels, not bytes
#rnx
#rb jeanfrancois.dube

[CL 24251953 by sebastien lussier in ue5-main branch]
2023-02-16 02:09:13 -05:00
sebastien lussier
d5b66a61f2 Material Baking - Added optimized code path when baking a set of meshes with remapped UVs
* In this case, instead of baking each mesh material property to it's own buffer, we can write all the meshes to the same buffer as their UVs are already the final ones that do not overlap
* Memory usage is greatly reduced (in test case with ~300 materials to bake, peak is reduced by 5.5GB)
* A lot faster to process (~2x in most cases) as we are doing a single RT readback per baked material property
* We can also skip the final merge of the baked outputs, as we have a single one

Refactored the material baking module to have both code paths (single output and multi outputs) share as much code as possible

#rb jeanfrancois.dube
#preflight 63eba6e0284e76cdadbecb48

[CL 24226039 by sebastien lussier in ue5-main branch]
2023-02-14 22:23:44 -05:00
sebastien lussier
f026ca0289 Material Baking - When force streaming in all the referenced textures mips, use a better(faster) mechanism to wait for completion
#rb jeanfrancois.dube

[CL 24174522 by sebastien lussier in ue5-main branch]
2023-02-13 10:07:21 -05:00
sebastien lussier
4f5f06aea0 Added a CRC to the MaterialBaking module, to be able to detect if code (by changing the base key) or setting changes could require an HLOD rebuild
#rb jeanfrancois.dube

[CL 24082386 by sebastien lussier in ue5-main branch]
2023-02-08 16:14:18 -05:00
sebastien lussier
bda8942ff2 Material Baking - Added "MaterialBaking.ForceDisableEmissiveScaling" CVar (disabled by default)
* If set to true, values stored in the emissive textures will be clamped to the [0, 1] range rather than being normalized and scaled back using the EmissiveScale material static parameter
#rb jeanfrancois.dube

[CL 24075476 by sebastien lussier in ue5-main branch]
2023-02-08 12:33:41 -05:00
aidin abedi
5e47c0fe58 Fix incorrect normals when baking certain materials. The issue is due to a change in 5.2, which introduces a new virtual method, FMaterialResource::IsTangentSpaceNormal, that determines whether a material uses tangent-space normals or world-space. The baking module needs to override this method and forward all IsTangentSpaceNormal calls to the actual material being baked to properly determine which space the normals should be in.
#jira UE-170383 UE-173004
#preflight 63df227378716a01e849bc7b
#rb massimo.tristano
#lockdown jeanmichel.dignard

[CL 24031430 by aidin abedi in ue5-main branch]
2023-02-06 11:19:41 -05:00
aidin abedi
7205306d48 Add FMaterialBakingModule::IsLinearBake to determine if a material property is baked to a linear texture or not
#jira none
#review @Jason.Nadro @Kevin.Ortegren
#preflight 63c9795a0225f00e14a99bd8

[CL 23808244 by aidin abedi in ue5-main branch]
2023-01-23 01:21:39 -05:00
aidin abedi
d58aa5718b Fix incorrect results when material baking some properties in a translucent material. To also avoid future issues like this, the fix removes all hard-coded assumptions in the baking module, regarding which properties are active depending on blend mode. These assumptions are not feasible to manually keep in-sync with the latest material behavior and therefore it's better to let the caller of the material baking module decide how to handle potentially inactive properties.
#jira UE-174381
#review @Massimo.Tristano @Kevin.Ortegren
#preflight 63c70eb22e714f64ad562f69

[CL 23773062 by aidin abedi in ue5-main branch]
2023-01-19 09:47:31 -05:00
aidin abedi
86152b0bc7 Add support for material baking custom output transmittance color and fix crash when baking invalid custom output
#jira UE-131149
#preflight 63ae50efc16855964d09967c
#review @Kevin.Ortegren @Massimo.Tristano

(based on PR #8498)

[CL 23767003 by aidin abedi in ue5-main branch]
2023-01-18 18:21:18 -05:00
aidin abedi
7d0da30082 Add support for material baking refraction property
#jira UE-131147
#review @Kevin.Ortegren @Massimo.Tristano

(based on PR #8496)
#preflight 63c6ce4f3f587d9e14ece2b0

[CL 23739612 by aidin abedi in ue5-main branch]
2023-01-17 11:53:37 -05:00
aidin abedi
8fe4cdb936 Add support for using material baking to efficiently check UV overlap
#jira UE-131151
#review @Kevin.Ortegren @Massimo.Tristano

(based on PR #8500)
#preflight 63c6c7ff02024f93d861359e

[CL 23739117 by aidin abedi in ue5-main branch]
2023-01-17 11:26:41 -05:00
aidin abedi
cd6a77b27f Add support for material baking shading model property
#jira UE-131148
#review @Kevin.Ortegren @Massimo.Tristano

(based on PR #8497)
#preflight 63c6c0220b358b97d1983695

[CL 23738607 by aidin abedi in ue5-main branch]
2023-01-17 10:53:19 -05:00
aidin abedi
001c32df84 Add support for material baking expressions that rely on primitive data
#jira UE-132097
#review @Kevin.Ortegren @Massimo.Tristano

(based on PR #8526)
#preflight 63c6b27302024f93d8591a46

[CL 23737565 by aidin abedi in ue5-main branch]
2023-01-17 09:51:53 -05:00
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
massimo tristano
7043371116 Added check that reports errors if a parameter is added in a Material bound to different values. This should not be allowed.
Code now checks for this occurrences and reprorts an error message instead of siliently trying to compile the material anyway.

This was causing a crash when two material functions containing the same parameter bound to different values (e.g. different textures) are used in the same material.

#jira UE-150412
#rb jeremy.moore
#preflight 63bc4896bf54fa7b36f61ea5
#preflight 63c13055b0652247507fae3e

[CL 23675742 by massimo tristano in ue5-main branch]
2023-01-13 05:36:38 -05:00
massimo tristano
9e4720a5bd Undo changelist 23624757.
#preflight 63bd624ad862fdd347d9fda2

[CL 23625729 by massimo tristano in ue5-main branch]
2023-01-10 08:18:49 -05:00
massimo tristano
98e8affa58 Added check that reports errors if a parameter is added in a Material bound to different values. This should not be allowed.
Code now checks for this occurrences and reprorts an error message instead of siliently trying to compile the material anyway.

This was causing a crash when two material functions containing the same parameter bound to different values (e.g. different textures) are used in the same material.

#jira UE-150412
#rb jeremy.moore
#preflight 63bc4896bf54fa7b36f61ea5

[CL 23624757 by massimo tristano in ue5-main branch]
2023-01-10 04:45:56 -05:00
massimo tristano
a8dc32e175 Undo changelist 23611477
#preflight 63bc20b068068a8bd6e6cca0

[CL 23611763 by massimo tristano in ue5-main branch]
2023-01-09 09:24:30 -05:00
massimo tristano
755e6df654 Added check that reports errors if a parameter is added in a Material bound to different values. This should not be allowed.
Code now checks for this occurrences and reprorts an error message instead of siliently trying to compile the material anyway.

This was causing a crash when two material functions containing the same parameter bound to different values (e.g. different textures) are used in the same material.

#jira UE-150412
#rb jeremy.moore
#preflight 63bc17dd68068a8bd6e4b7bb

[CL 23611477 by massimo tristano in ue5-main branch]
2023-01-09 08:52:28 -05:00
christopher waters
0d5b23e2e3 Adding includes to prepare for a header dependency cleanup.
#preflight 63b5e0bfff7b9ad7030f0f81

[CL 23581920 by christopher waters in ue5-main branch]
2023-01-04 17:07:40 -05:00
christopher waters
f8abec7a8e Material header dependency cleanup
- Removing MaterialAttributeDefinitionMap and MaterialRenderProxy from MaterialShared.h
- Removing MaterialShared from Material.h

#preflight 639cbb35776b61ba3b82f03e

[CL 23541603 by christopher waters in ue5-main branch]
2022-12-16 16:24:02 -05:00
christopher waters
7215f7d4ec Fully moving MaterialDomain to its own header.
#jira none
#preflight 639b4dc335203bc7aa695078

[CL 23531533 by christopher waters in ue5-main branch]
2022-12-15 16:01:51 -05:00