Shaders - bUsedWithClothing & SkeletalMesh VS SpeedTree = NoGo
(Using v4.5.1) Hi, I'm posting this bug because I spent a whole day trying to solve it and found out a couple things that could save hours to a shader intensive project along with a solution.
Basically, SpeedTree nodes plugged in the world position offset with the shader's bUsedWithSkeletalMesh and bUsedWithClothing BOTH set to true will create a shader compile error that is VERY hard to trouble shoot if you don't look at the output log. (Did it with a new empty shader and I can replicate this)
The problem was triggered when one of our artist used my Master Masked shader for the first time on a skeletal mesh using cloth for the fur. (Why Masked? I used a noise dither pass to fake translucency with temporal AA).
This caused all Master Masked material instances to be recompiled on editor startup (it automaticaly checked bUsedWithSkeletalMesh and bUsedWithClothing) and all speedtree leaves and billboards were replaced by empty shaders with its instances saying:
MaterialEditorStats:Error: Error [SM5] warning X3206: implicit truncation of vector type MaterialEditorStats:Error: Error [SM5] error X3536: Duplicated input semantics can't change type, size, or layout ('ATTRIBUTE9').
Along with something like this in the output log: Warning: Failed to compile Material /Engine/Transient.PreviewMaterial_0 for platform PCD3D_SM5, Default Material will be used in game.
And a bunch of these copy paste lines with the map containing the speedTree assets: Material /Game/Art/Materials/Masters/M_Master.M_Master needed to have new flag set bUsedWithSkeletalMesh !
Material /Game/Art/Materials/Masters/M_MasterMontagne.M_MasterMontagne needed to have new flag set bUsedWithSkeletalMesh !
Material /Game/Art/Materials/Masters/M_MasterMasked.M_MasterMasked needed to have new flag set bUsedWithSkeletalMesh !
/Art/Materials/Masters/M_MasterMasked.M_MasterMasked needed to have new flag set bUsedWithClothing !
Material /Game/Art/Meshes/Static/Vegetation/SpeedTree/Maple_03/Maple_small_Fronds_Mat.Maple_small_Fronds_Mat needed to have new flag set bUsedWithInstancedStaticMeshes !
LogShaderCompilers:Warning: Failed to compile Material /Game/Art/Materials/Masters/M_MasterMasked.M_MasterMasked for platform PCD3D_SM5, Default Material will be used in game.
If materials were not re-saved (by not looking at the output log for a couple days! oops), all Masked shaders had to be recompiled at every editor startup / restart ( which in our case amounted to 14000 to 36000 shader instructions to compile = 45min of waiting time for every artists working in the editor! And the editor crashes 10-20 / day / artist)
Took a long while to figure out it was those shader booleans that cause shader recompile on editor startup.
I wrote this to tell people to both avoid using SpeedTree with Skeletal+Cloth and avoid editor startup recompiling by checking their output log. The first is an implicit bug that I don't think is useful to solve (why use cloth with speed tree on a skeletal???) but would help to have a specific exception handling when using this shader configuration for future users using gigantic master shaders.
Note it was using r.ShaderDevelopmentMode when I found the exact source. Info found at: https://docs.unrealengine.com/latest/INT/Programming/Rendering/ShaderDevelopment/index.html
(I copy pasted a lot to help google searches)
Thank you for reporting this. I was able to reproduce this by just setting a single speedtree node to use skeletal mesh and clothing without the need for a complex setup. For reference I've submitted a ticket for this with UE-6806.
answered Dec 17 '14 at 06:39 PM
Tim Hobson ♦♦ STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here