What's the fastest way to render and raycast thousands of (individually selectable) static meshes ?


I have thousands of meshes (currently around 2500) I want to render using UE4. It’s a visualization of the human body and each individual medically labeled piece is a separate OBJ. If I add all these models to the scene as actors rendering is incredibly slow (I assume due to thousands of separate draw-calls). I then tried to add all OBJs as components of a single actor is still very slow. I then tried to spatially cluster and merge OBJs (using blender) and differentiating the individual pieces by different element-IDs (aka material-IDs) which is considerably faster to render and I can still select pieces by changing the material for the appropriate material ID. So this approach kinda works. Does anyone know of a faster way than this I could try ?

However raycasting through such a dense model (in order to select parts of it) is very slow, so I need to optimize this. To do any sort of hand-optimization for the raycast it would be necessary to tell the TraceLine function (or similar) to only check for certain actors or even only certain components within given actors. Is anyone aware of such a function ? I only find actors-to-ignore options which won’t really work for my use-case.

Thanks you very much for any help.

Cheers, Lennert

You need to create your own collision or trace channels. When you do the trace, select which channel you want to trace on.