Description

On a DDC hit, the SubstrateMaterialBsdfFeatures variable restored into MaterialCompilationOutput is not copied into SubstrateTranslatorData.SubstrateMaterialBsdfFeatures, which is referenced by the subsequent GetMaterialEnvironment function. As a result, the MATERIAL_SHADINGMODEL_TOON flag fails to propagate to the material.

The following fix works:

 		else
		{
			MaterialCompilationOutput = DDCMaterialCompilationOutput;
			// workaround : SubstrateTranslatorData.SubstrateMaterialBsdfFeatures is refenrenced in GetMaterialEnvironment
			SubstrateTranslatorData.SubstrateMaterialBsdfFeatures = MaterialCompilationOutput.SubstrateMaterialCompilationOutput.SubstrateMaterialBsdfFeatures;


Steps to Reproduce

In FHLSLMaterialTranslator::Translate, there is a race between the DDC load and the local translate.
Inserting a wait makes it easier to reproduce the issue.

  1. Insert Sleep
	// Asynchronously query the DDC for results
	if (!bForceDisableDDCQuery && !bDisableTranslationDDC)
	{
		AsyncQueryDDC(DDCRequestOwner, EnvironmentDefinesBuffer);
	}

	// Synchronously begin translating the material
	{
		SCOPE_SECONDS_COUNTER(TranslationOnlyTime);
		TranslateMaterial();
	}

	// One of the two has terminated. This will be a NOOP if DDC query task has completed.
#if 0
    DDCRequestOwner.Cancel();
#else
    DDCRequestOwner.Wait();
#endif
  1. Set a breakpoint at around line 1262 and check the variable values.
    Adding a log like the following can help:
		if (EnvironmentDefines->ParameterCollections.Contains(nullptr))
		{
			TranslationResult = EHLSLMaterialTranslatorResult::RetryWithoutDDC;
		}
		else
		{
			MaterialCompilationOutput = DDCMaterialCompilationOutput;
			// Add log to debug
            if (EnumHasAnyFlags( MaterialCompilationOutput.SubstrateMaterialCompilationOutput.SubstrateMaterialBsdfFeatures, ESubstrateBsdfFeature::Toon ) )
			{
				UE_LOGF(LogMaterial, Display, "Material BSDFFlag %x %x.", MaterialCompilationOutput.SubstrateMaterialCompilationOutput.SubstrateMaterialBsdfFeatures, SubstrateTranslatorData.SubstrateMaterialBsdfFeatures );
			}
			STAT(DDCRequestSerializeTime += SerializeTime - FPlatformTime::Seconds());
			STAT(GShaderCompilerStats->IncrementMaterialCacheHit());
			TranslationResult = EHLSLMaterialTranslatorResult::Success;
		}

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-388460 in the post.

0
Login to Vote

Unresolved
CreatedJul 27, 2026
UpdatedAug 4, 2026
View Jira Issue