Download

4.22 Mesh drawing pipline breaks imposter materials

Hello,

I’ve been using the imposter baker from Ryan Brucks and it used to work in the versions of unreal priory to 4.22.
I saw that the mesh drawing pipeline has been updated and I’m guessing some code needs to also be re adapted to the new pipeline.

Currently I run into the following error in the material editor:

[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.

Ryan is using some custom code in the material in the WorldtoLoc nodes :

#if USE_INSTANCING || IS_MESHPARTICLE_FACTORY
return mul(InWorldVector, transpose(Parameters.InstanceLocalToWorld));
#else
return mul(InWorldVector, (MaterialFloat3x3)Primitive.WorldToLocal);
#endif

And also :

#if USE_INSTANCING || IS_MESHPARTICLE_FACTORY
float3 temp;
temp.x = length(TransformLocalVectorToWorld(Parameters, float3(1,0,0)));
temp.y = length(TransformLocalVectorToWorld(Parameters, float3(0,1,0)));
temp.z = length(TransformLocalVectorToWorld(Parameters, float3(0,0,1)));
return mul(InWorldVector, (MaterialFloat3x3)transpose(Parameters.InstanceLocalToWorld)) / (temp*temp);
#else
return mul(InWorldVector, (MaterialFloat3x3)Primitive.WorldToLocal);
#endif

Also the material seems to break at the vertexInterpolator node.

As an environment artist, my programming knowledge is abysmal, any help or direction how to solve this issue would be greatly appreciated.

I found a fix for a scaling issue I wanted to share. Test it out if this works for you.
The screenshot/fix is applied in the function “Impostor_ThreeFrameBlend” and fixed the scaling issues I had.

Hope this might still help someone.