Niagara HLSL Get Skeletal Mesh Vertex Position

I have a custom HLSL node in a simulation stage in Niagara. One of the input variables to this node is of type Skeletal Mesh and I want to get the position and normal of a given vertex on that skeletal mesh by the index of the vertex.

In other words, I want to do the equivalent of the GetSkinnedVertexDataWS node, but in HLSL. Is this possible?

I couldn’t find any documentation on it. I tried this code

bool myBool;
float3 VertexPosition;
ParticleMesh.GetSkinnedVertexDataWS<Attribute="Position">(i, myBool, VertexPosition);
float3 VertexNormal;
ParticleMesh.GetSkinnedVertexDataWS<Attribute="Normal">(i, myBool, VertexNormal);

where ‘i’ is the index of the vertex I want (from a loop), but I get the error

“‘GetSkinnedVertexDataWS_SystemParticleMesh_AttributePosition’: cannot convert output parameter from ‘float3’ to ‘bool’ SPH_Emitter, Particle GPU Compute Script”.

I also tried a few variations to no avail.


Picking through the USH files in “\UE_4.26\Engine\Plugins\FX\Niagara\Shaders\Private”, and looking in “NiagaraDataInterfaceSkeletalMesh.ush” in particular, it would seem that the call should be GetSkinnedVertexWS not GetSkinnedVertexDataWS.

However, when I make this change the error I get now is

/Engine/Generated/NiagaraEmitterInstance.ush(1563,3-14): Err0r X3004: undeclared identifier ‘ParticleMesh’ SPH_Emitter, Particle GPU Compute Script,

This makes no sense to me. ParticleMesh is most definitely declared - as I say, it’s an input to the custom HLSL node.

I don’t know what the error refers to when it mentions “NiagaraEmitterInstance.ush” either. There’s a “NiagaraEmitterInstanceShader.usf” but no USH file.

This has been an entire weekend wasted with zero progress. It doesn’t help that there’s next to no documentation. Nor does it help that I have to click an arbitrary parameter on the emitter on and off to reveal the error in the Niagara Log for 0.2s, whack the print screen key and paste the screenshot into Photoshop just to examine the error log, every single time I make a change.

Well, it’s been a week with no answer. Someone must have an idea. Why would it let you use a skeletal mesh as an input to a simulation stage and a custom HLSL node if it doesn’t work?

Just in case anyone will need this - I got it working in UE5.0 EA:

float3 Position;
float3 Velocity;
float3 Normal;
float3 Binormal;
float3 Tangent;

SkelMesh.GetSkinnedVertexDataWS(i, Position, Velocity, Normal, Binormal, Tangent);

OutLocation = Position;

1 Like