Writing a VertexFactory shader, is there a template or defined interface to implement?

I’m trying to implement a custom VertexFactory shader. It will be a simple particle type setup, and will be rendering instanced quads. These particles will be generated from a compute shader, so using the Unreal systems like InstancedStaticMesh or a Niagara Particle System will not work (at least not without major modifications to those systems). These quads will use a regular UMaterial, and should ideally be able to render into any of the main render passes used by the deferred renderer.

Now, I believe I have correctly implemented the Vertex Factory. It is derived from FVertexFactory, not FLocalVertexFactory. I have also implemented the Scene Proxy, but now I need to implement the vertex factory shader, and I am at a loss as to what to do.

Is there a defined interface that the implemented shader needs to conform to? For example, all the other vertex factories I have looked at implement this function:

FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float3 WorldPosition, float3x3 TangentToLocal)

But how do I know that I need to implement this? Basically, I am looking for a list of all such functions that need to be implemented in order to have a correct vertex factory shader.

Also, if I have taken a wrong path and there is a more correct way to do what I am asking for. For example, I may be able to implement a copy of LocalVertexFactory, but from what I have seen, that is more complex than using a regular vertex factory.

Thank you.

1 Like