Custom expresion dx12

I use gdc plugin for volumetrick material and when switch to dx12 I have error:
[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.

I try fix it but I havent any reference with GetPrimitiveData how it use

primitive replace by GetPrimitiveData(Parameters.PrimitiveId)

Did you get it to work? It seems to be connected to transformposition (local to world space) node I think? It broke octahedral impostors for me in 4.22

Can you take a screenshot?

Hi, I got the same issue here too, how can we fix this issue?

This the old code that needs to be updated :

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

I’m no programmer and not sure how to update to code to make this work.

To clarify this answer, as it is correct, but not descriptive. Basically anywhere it says “Primitive” replace that word and only that word with “GetPrimitiveData(Parameters.PrimitiveId)”

Here is the Documentation: Mesh Drawing Pipeline Conversion Guide for Unreal Engine 4.22 | Unreal Engine Documentation
Scroll all the way to the bottom.

Ex:
localcampos = (localcampos / (Primitive.LocalObjectBoundsMax.x)) ;

Becomes:
localcampos = (localcampos / (GetPrimitiveData(Parameters.PrimitiveId).LocalObjectBoundsMax.x;

1 Like