Fixing the default Impostor Shaders that show a “GetPrimitiveData” error

You may sometimes encounter a shader compiler error stating:

[SM5] Shader attempted to bind the Primitive uniform buffer even though Vertex Factory FLocalVertexFactory computes a PrimitiveId per-instance. This will break auto-instancing. Shaders should use GetPrimitiveData(Parameters.PrimitiveId).Member instead of Primitive.Member.

If you get this error, you can fix it quite simply by “Show Engine Content” in the file browser and go down to the “ImpostorBaker/Materials” folder and edit the “Impostor_ThreeFrameBlend” (In 4.27 up, it’s just called “Impostor”) MaterialFunction.

There are 5 places where you need to replace “Primitive” to “GetPrimitiveData(Parameters.PrimitiveId)”. In 4.26 you can search for “WorldToLoc” and it returns them, but in 4.25 for some reason that doesn’t work – you’ll need to manually locate them using the image below:

Go through each one and select it. In the “Details” Pane on the left you will see a section called “Code” which contains the HLSL shader code with those errors in them.

At the bottom of each one, you’ll see a line with “(MaterialFloat3x3)Primitive.WorldToLocal” – replace the “Primitive” with “GetPrimitiveData(Parameters.PrimitiveId)”.

That should be all you need to do. Once you’ve replaced all 5 the Material should compile.