Approximate HLOD material

I am trying to figure out what is the correct way to bake materials in the approximate hlod mode.

In \Engine\Plugins\Experimental\MeshModelingToolsetExp\Source\GeometryProcessingAdapters\Private\ApproximateActorsImpl.cpp if there is no override material you choose FullMaterialBakeOutputMaterial_PackedMRS or FullMaterialBakeOutputMaterial (based on spec+metallic+rougheness packing).

However, if I want to force one of these materials, I get a warning in ProxyMaterialUtilities.cpp:

Warning: Material FullMaterialBakeOutputMaterial_PackedMRS is missing required Material Parameters UseBaseColor+BaseColorTexture+BaseColorConst|UseDiffuse+DiffuseTexture+DiffuseConst, UseNormal, UseMetallic+MetallicTexture+MetallicConst, UseRoughness+RoughnessTexture+RoughnessConst, UseSpecular+SpecularTexture+SpecularConst, UseOpacity+OpacityTexture+OpacityConst, UseOpacityMask+OpacityMaskTexture+OpacityMaskConst, UseAmbientOcclusion+AmbientOcclusionTexture+AmbientOcclusionConst, UseEmissiveColor+EmissiveColorTexture+EmissiveColorConst|UseEmissive+EmissiveTexture+EmissiveConst, PackedTexture, PackMetallic, PackSpecular, PackRoughness

So the engine ignores my override and choose the default flatten material. This material is made for MergeActor tool and not HLOD. HLOD code does not properly set all static booleans (such as UseSpecular, UseAmbientOcclusion and so on). So the entire system works only if specular, roughness, metal map are baked.

I don’t understand what should be your HLODMaterial default value too: you choose GEngine->DefaultHLODFlattenMaterial in UHLODBuilderMeshApproximateSettings, but then revert to GEngine->DefaultFlattenMaterial in UHLODBuilderMeshApproximate::Build.

[Attachment Removed]

Steps to Reproduce

Setup a scene where a mesh has to generate an HLOD with the approximate flattening method and choose to bake materials. Use FullMaterialBakeOutputMaterial_PackedMRS as the override base material to use. Verify the used material after the build process

[Attachment Removed]

Hi,

The name of the Param2D nodes in FullMaterialBakeOutputMaterial_PackedMRS and FullMaterialBakeOutputMaterial are not matching the expected names during the validation. The Warning is a bit confusing but that is essentially what this mean. As an example, both material have a node named BaseColor but the code is looking for BaseColorTexture. The same is true for the rest of the reported missing parameter.

I have filed a bug report so this can be reviewed and fixed. You will be able to follow its evolution here: https://issues.unrealengine.com/issue/UE\-363562\. The link might take a couple of hours to be live.

Regards,

Martin

[Attachment Removed]