Shader TMaterialCHSFNoLightMapPolicyFAnyHitShader Cook Error

I have an error that is occurring on the cook of our project for a specific material. There is no errors in PIE, so this has been interesting to track down the problem. It happened after we turned on HWRT as far as I can tell. Below is the errors in the cook logs.

---

LogMaterial: Display: [CookWorker 3]: Missing cached shadermap for M_MergedCharacter_Hair in PCD3D_SM6, Default, SM6, Game (DDC key hash: 687103844b9b28d820cfbe5f0f708e68e5cdafc6), compiling.

[2025-07-24T07:08:31.412Z] LogShaderCompilers: Warning: [CookWorker 3]: Failed to compile Material /Game/CharacterCreator/Characters/Materials/Master/SlotAgnostic/M_MergedCharacter_Hair.M_MergedCharacter_Hair for platform PCD3D_SM6, Default Material will be used in game.

[2025-07-24T07:08:31.412Z] \Engine\Shaders\Private\RayTracing\RayTracingMaterialHitShaders.usf(0): Shader TMaterialCHSFNoLightMapPolicyFAnyHitShader, Permutation 0, VF FLocalVertexFactory:

[2025-07-24T07:08:31.412Z] error: validation errors

[2025-07-24T07:08:31.412Z]

[2025-07-24T07:08:31.412Z] \Engine\Binaries\Win64\RayTracingMaterialHitShaders.dxil(4640,31): Shader TMaterialCHSFNoLightMapPolicyFAnyHitShader, Permutation 0, VF FLocalVertexFactory:

[2025-07-24T07:08:31.412Z] RayTracingMaterialHitShaders.dxil:4640:31: error: No indefinite logarithm.

[2025-07-24T07:08:31.412Z] \Engine\Binaries\Win64\PathTracingMaterialHitShader.dxil(5161,31): Shader FPathTracingMaterialCHS_AHS, Permutation 0, VF FLocalVertexFactory:

[2025-07-24T07:08:31.412Z] PathTracingMaterialHitShader.dxil:5161:31: error: No indefinite logarithm.

[2025-07-24T07:08:31.412Z] \Engine\Binaries\Win64\PathTracingMaterialHitShader.dxil(5178,31): Shader FPathTracingMaterialCHS_AHS, Permutation 0, VF FInstancedStaticMeshVertexFactory:

[2025-07-24T07:08:31.412Z] PathTracingMaterialHitShader.dxil:5178:31: error: No indefinite logarithm.

[2025-07-24T07:08:31.412Z] \Engine\Binaries\Win64\RayTracingMaterialHitShaders.dxil(4657,31): Shader TMaterialCHSFNoLightMapPolicyFAnyHitShader, Permutation 0, VF FInstancedStaticMeshVertexFactory:

[2025-07-24T07:08:31.412Z] RayTracingMaterialHitShaders.dxil:4657:31: error: No indefinite logarithm.

[2025-07-24T07:08:31.412Z]

[2025-07-24T07:08:31.412Z] LogCook: Display: [CookWorker 3]: Cooked packages 6983 Packages Remain 4627 Total 11610

[2025-07-24T07:08:31.412Z] LogMaterial: Warning: [CookWorker 3]: Cooking a material resource (in M_MergedCharacter_Hair hierarchy) that doesn’t have a valid ShaderMap! Shadermap pointer is null.

---

Searching around hasn’t brought up anything I might be missing, such a a Usage Flag, but it would be lovely if it was just a checkbox :wink:

Let me know if there is anything I can do to help provide more information. I’ve set this to community so some others might be able to benefit from the answer, but if I need to provide a material, it would be better if is was private.

Cheers,

Anthony

Steps to Reproduce

Hello,

I didn’t find any matching internal known issues - though we do occasionally get these compilation errors, for example:

(UE-263190) Opcode shader compilation error when using a TextureSampleParameterCubeArray node with hardware ray tracing enabled

Do you have any nodes in your Material that use Log() and may output an infinite value?

I’m not using log() in any MF or in the material.

I will look again to make sure 100% it’s not being used. maybe it’s hidden in some custom block I missed, but I don’t think we are. Are there things I should be looking for with HWRT turned on in materials? like a usage flag I might miss or.. anything like that?

Ok. I went through every MF and nested MF:

I have no use of log() in any of them.

Also, I checked the output log and there was no warnings or errors contained within.

There are no custom nodes for me to work through either.

If there are any known nodes that don’t play well with HWRT, that would also be super helpful.

OKAY! Found something interesting. If I uncheck “Cast Ray Traced Shadows” and apply, then recheck it back on I now am getting the compiling errors in the material editor. Still not sure what’s the error, but working through it.

Secondarily found another problem hidden!

There was a Material Function nested that we were using a stochastic alpha noise function which was working with some ddx / ddy functions. I’m making this raytracing safe and testing

It looks like when Hardware Raytracing is enabled all of your shaders that are casting raytracing shadows needs to be thought of thoroughly with this in mind and have the ray and path tracing quality switch in place for use while also being very cautious about log() and log2() nodes.

Hello, apologies for the delay. Do you get this same error if you disable the path tracer? We haven’t seen this yet in vanilla UE, but if you’re able to provide some repro steps or reproduce the issue in a sample project that you can share with us that’d help us troubleshoot further.

We ended up solving all of our cook warnings by several things.

We needed to add ray and pathtracing switches in the materials that we felt were safe data wise.

Then secondarily there are some custom nodes using Log2()/Log() which were hiding from me!

But I found them all and I added in some max(value, 0.0001) to safeguard the data to not be able to divide by 0.

It looks like I am good to go and it was all me!

You can close this up.

Thanks for the guidance.