DOTS and ECS for Shadow Volume Generation

I’ve a prototype system for generating shadow volumes and rendering these using Carmack’s reverse to the stencil buffer and effectively create nice neat shadows. It’s even working well on the Quest 3, in so far as it runs with simple shaders and simple shadow volumes at around 5-6ms frame time, with about 1-2ms of this being spent doing edge detection and shadow volume creation. This is with 144 cubes, so the edge detection and volumes are simple, naturally the cost of these jumps up with more complex volumes. The plan is to keep the volumes simple, however, as this is a low-poly game, plus the shadow volumes can be simpler.

I am toying with DOTS and also compute shaders. I think DOTS will be far simpler to develop and debug but I’m not so sure of the best approach.

At present I have a mesh I use for the shadows that I am converting into some structures I can use to find the silhouette and project the volume out. I am setting the mesh data for a new mesh having done so and I have a single mesh per volume and updating every frame. Because of how this method works I have to render the shadow volumes after rendering the scene to set the Z-buffer.

Given the above, it feels like I could get some parallelisation of the edge detection with DOTS but I’m unsure the best way to collate the volume data - should I continue to create one volume per shadowing object or should I lump them all together? How can I do so and get multi-threading support from the jobs system? If I continue with one volume per shadow object, how can I commit the shadow information back to the mesh, currently I am using SetIndices() on Mesh.

Appreciate this is a broad question but just looking for some suggestions and advice on whether this is likely to see me a speed increase. 2ms is not terrible, but if I had a 10x or more the data I’d want it to not be more then say 3ms, hence trying to reduce the cost.

Thanks in advance