UE 5.1 : Movie Render Queue - Compiling Shaders every frame

Hi, did you solve this problem?

So found a solution for myself in 8 years old reddit topic.

  1. Check your log folder [yourproject]/Saved/Logs
    My problem was in a parent shader that was using 17/16 samples.

Failed to compile Material for platform PCD3D_SM6, Default Material will be used in game.
Shader is using too many Samplers: 17 (only 16 supported)

  1. Open your failed material, and change Texture Sample > Sample Source > Shared:Wrap

3 Likes

Since some smart people seem to have figured this out by now, could i please ask for some help to decipher this error message? :smiley:

I cant figure out what the material referred to even is. I find nothing when I search for it.

It’s the same problem as everyone else here had, it compiles shaders on every subframe rendered. 4 shaders, in my case. When i restart my engine the compiling goes away - until i use metahuman performance, which triggers the problem again.

Error from in engine output Log:
LogShaderCompilers: Warning: Failed to compile Material /Engine/Transient.ABView_Material for platform PCD3D_SM5, Default Material will be used in game.
/Engine/Generated/Material.ush:2756:8: warning: implicit truncation of vector type [-Wconversion]
return Result;
^
error: validation errors
zzz.dxil:19039:13: error: Opcode Sample not valid in shader model lib_6_6(closesthit).
note: at β€˜%687 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %684, %dx.types.Handle %686, float %660, float %664, float undef, float undef, i32 0, i32 0, i32 undef, float undef)’ in block β€˜#36’ of function β€˜?MaterialCHS@@YAXUFPackedMaterialClosestHitPayload@@UFRayTracingIntersectionAttributes@@@Z’.
zzz.dxil:19035:13: error: Opcode Sample not valid in shader model lib_6_6(closesthit).
note: at β€˜%678 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %675, %dx.types.Handle %677, float %660, float %664, float undef, float undef, i32 0, i32 0, i32 undef, float undef)’ in block β€˜#35’ of function β€˜?MaterialCHS@@YAXUFPackedMaterialClosestHitPayload@@UFRayTracingIntersectionAttributes@@@Z’.
zzz.dxil:19005:25: error: Opcode Sample not valid in shader model lib_6_6(closesthit).
note: at β€˜%630 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %627, %dx.types.Handle %629, float %354, float %355, float undef, float undef, i32 0, i32 0, i32 undef, float undef)’ in block β€˜#31’ of function β€˜?MaterialCHS@@YAXUFPackedMaterialClosestHitPayload@@UFRayTracingIntersectionAttributes@@@Z’.
zzz.dxil:18997:24: error: Opcode Sample not valid in shader model lib_6_6(closesthit).
note: at β€˜%621 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %618, %dx.types.Handle %620, float %354, float %355, float undef, float undef, i32 0, i32 0, i32 undef, float undef)’ in block β€˜#30’ of function β€˜?MaterialCHS@@YAXUFPackedMaterialClosestHitPayload@@UFRayTracingIntersectionAttributes@@@Z’.
zzz.dxil:18984:11: error: Opcode Sample not valid in shader model lib_6_6(closesthit).
note: at β€˜%596 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %593, %dx.types.Handle %595, float %354, float %355, float undef, float undef, i32 0, i32 0, i32 undef, float undef)’ in block β€˜#28’ of function β€˜?MaterialCHS@@YAXUFPackedMaterialClosestHitPayload@@UFRayTracingIntersectionAttributes@@@Z’.
zzz.dxil:18980:11: error: Opcode Sample not valid in shader model lib_6_6(closesthit).
note: at β€˜%583 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %580, %dx.types.Handle %582, float %354, float %355, float undef, float undef, i32 0, i32 0, i32 undef, float undef)’ in block β€˜#26’ of function β€˜?MaterialCHS@@YAXUFPackedMaterialClosestHitPayload@@UFRayTracingIntersectionAttributes@@@Z’.
Validation failed.
D3DCompileToDxil failed. Error code: Odefinierat fel (0x80004005).
zzz.dxil:20122:13: error: Opcode Sample not valid in shader model lib_6_6(closesthit).
note: at β€˜%671 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %668, %dx.types.Handle %670, float %644, float %648, float undef, float undef, i32 0, i32 0, i32 undef, float undef)’ in block β€˜#26’ of function β€˜?PathTracingMaterialCHS@@YAXUFPackedPathTracingPayload@@UFRayTracingIntersectionAttributes@@@Z’.
zzz.dxil:20118:13: error: Opcode Sample not valid in shader model lib_6_6(closesthit).
note: at β€˜%662 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %659, %dx.types.Handle %661, float %644, float %648, float undef, float undef, i32 0, i32 0, i32 undef, float undef)’ in block β€˜#25’ of function β€˜?PathTracingMaterialCHS@@YAXUFPackedPathTracingPayload@@UFRayTracingIntersectionAttributes@@@Z’.
zzz.dxil:20088:25: error: Opcode Sample not valid in shader model lib_6_6(closesthit).
note: at β€˜%614 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %611, %dx.types.Handle %613, float %459, float %460, float undef, float undef, i32 0, i32 0, i32 undef, float undef)’ in block β€˜#21’ of function β€˜?PathTracingMaterialCHS@@YAXUFPackedPathTracingPayload@@UFRayTracingIntersectionAttributes@@@Z’.
zzz.dxil:20080:24: error: Opcode Sample not valid in shader model lib_6_6(closesthit).
note: at β€˜%605 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %602, %dx.types.Handle %604, float %459, float %460, float undef, float undef, i32 0, i32 0, i32 undef, float undef)’ in block β€˜#20’ of function β€˜?PathTracingMaterialCHS@@YAXUFPackedPathTracingPayload@@UFRayTracingIntersectionAttributes@@@Z’.
zzz.dxil:20067:11: error: Opcode Sample not valid in shader model lib_6_6(closesthit).
note: at β€˜%580 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %577, %dx.types.Handle %579, float %459, float %460, float undef, float undef, i32 0, i32 0, i32 undef, float undef)’ in block β€˜#18’ of function β€˜?PathTracingMaterialCHS@@YAXUFPackedPathTracingPayload@@UFRayTracingIntersectionAttributes@@@Z’.
zzz.dxil:20063:11: error: Opcode Sample not valid in shader model lib_6_6(closesthit).
note: at β€˜%567 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %564, %dx.types.Handle %566, float %459, float %460, float undef, float undef, i32 0, i32 0, i32 undef, float undef)’ in block β€˜#16’ of function β€˜?PathTracingMaterialCHS@@YAXUFPackedPathTracingPayload@@UFRayTracingIntersectionAttributes@@@Z’.

I also have this problem on 5.4 with this error :

[2024.04.29-16.14.17:469][577]LogShaderCompilers: Warning: Failed to compile Material /Composure/Materials/Output/M_SrgbToLinear.M_SrgbToLinear for platform PCD3D_SM6, Default Material will be used in game.
/Engine/Generated/Material.ush:3340:24: error: condition for short-circuiting ternary operator must be scalar, for non-scalar types use β€˜select’
return Color > 0.04045 ? pow( Color * (1.0 / 1.055) + 0.0521327, 2.4 ) : Color * (1.0 / 12.92);;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
select(Color > 0.04045, pow(Color * (1. / 1.0549999999999999) + 0.052132699999999997, 2.3999999999999999), Color * (1. / 12.92))

I tried to delete the material function completely (which I don’t think is a good idea), and still get the error…
A lot of the actors are using this asset, most of them are PCG by the way
Any idea how to fix this ?

1 Like

Me too. 5.4

Guys… you’ve been given an answer and it is a correct one.

You have an offending shader in a material that is causing Unreal to replace it with a default shader and thus it has to recompile shader every frame.

Look at the log, find the offending material/s and fix it. If you can’t replace it and you won’t get the error.

It is not a bug, it is simply how engine works if it finds a bad material with shaders. It will try to fix it by replacing it and thus it will need to recompile the shaders.

As already answered:

Go to your project folder /Saved/Logs … find the latest log and look at the errors. It will tell you exactly the reason and which materials affect it.

To anyone still looking for the answer as discussed above just look for the failing materials in your output log and or saved directly search MI material or failing and fix the issues it could be

Virtual texture

Nanite issues

Or sampler usage also try turning off static light turned on

Btw love the community so many people actually answering is crazy :blue_heart: