Creating a FMeshMaterialShader and draw using RGD

Hello guys I am struggling with something it seems to be pretty complex,

I am trying to render a staticmesh into a render target using the existing mechanisms of UE, here is quick summary.

  1. I did manage to extract correctly a FMeshBatch from a UStaticMesh. To keep everything simple, for now it is just looking for the first section (first material)
  2. I have my vertex shader and my pixel shader inheriting from FMeshMaterialShader, it does compile, but I don’t know if the shaders work until I see something on my render target
  3. Here we have 2 options, the first one should be brute force, AFAIK the FMeshBatch object has enough information to draw the mesh, since it already contains the vertex buffer, index buffer and the vertex declaration, which I know those are the very minimum to draw something and by the other hand we have something called FMeshPassProcessor that according to the documentation this bad boy is the one of charge of creating the FMeshDrawCommand that will ultimately contain the final info to draw, for this to happen I am calling the function: DrawDynamicMeshPass over my custom FMeshPassProcessor, until here is where I am at, after calling my function I have a crash that I am not to enable to decipher yet.

I have isolated my code especially for it, so you guys can take a look. it is on UE5 btw

The final goal, of course, is learning, I want to draw a small GBuffer set of targets for now, my code is based on the GPULightmass which is doing exactly what I want to do: render a mesh uv coordinates to a texture. A good lecture should be LightmapGBuffer.h and .cpp and LightmapRenderer.h and cpp

Thank you guys, I will continue the fight