diff --git a/Source/glTFRuntime/Private/glTFRuntimeParserMaterials.cpp b/Source/glTFRuntime/Private/glTFRuntimeParserMaterials.cpp index 830e1b6c..d98c8d79 100644 --- a/Source/glTFRuntime/Private/glTFRuntimeParserMaterials.cpp +++ b/Source/glTFRuntime/Private/glTFRuntimeParserMaterials.cpp @@ -558,6 +558,15 @@ UMaterialInterface* FglTFRuntimeParser::BuildMaterial(const int32 Index, const F ApplyMaterialFloatFactor(RuntimeMaterial.bKHR_materials_clearcoat, "clearcoatFactor", RuntimeMaterial.ClearCoatFactor); ApplyMaterialFloatFactor(RuntimeMaterial.bKHR_materials_clearcoat, "clearcoatRoughnessFactor", RuntimeMaterial.ClearCoatRoughnessFactor); + for (const TPair& Pair : MaterialsConfig.ScalarParamsOverrides) + { + float ScalarValue = 0; + if (Material->GetScalarParameterValue(*Pair.Key, ScalarValue)) + { + Material->SetScalarParameterValue(*Pair.Key, Pair.Value); + } + } + for (const TPair& Pair : MaterialsConfig.ParamsMultiplier) { float ScalarValue = 0; diff --git a/Source/glTFRuntime/Public/glTFRuntimeParser.h b/Source/glTFRuntime/Public/glTFRuntimeParser.h index d0afc8f0..f0b29e96 100644 --- a/Source/glTFRuntime/Public/glTFRuntimeParser.h +++ b/Source/glTFRuntime/Public/glTFRuntimeParser.h @@ -465,6 +465,9 @@ struct FglTFRuntimeMaterialsConfig UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "glTFRuntime") UMaterialInterface* VertexColorOnlyMaterial; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "glTFRuntime") + TMap ScalarParamsOverrides; + FglTFRuntimeMaterialsConfig() { CacheMode = EglTFRuntimeCacheMode::ReadWrite;