I’ve published a package that defines some component data for point clouds and uses component systems to transfer the component data into render textures via compute shaders. The render textures are then passed as inputs to the VFX graph to define the position, rotation or even color per particle.
The example above is of 10 million quads being rendered on a mid range laptop at 45 fps and all of those points are representations of ECS data.
I did this because the hybrid renderer wasn’t able to render quite this many entities like the VFX graph can.
Another limitation of the hybrid renderer is that you can’t assign a unique color per mesh but with this you can.
This can be used for even larger boid simulations and things of that nature. I hope to combine this with the boid simulation example to get like 1 million vs 1 million boids flying through space shooting and stuff. I think it’d be pretty sick.
If anyone is willing to try it I really look forward to hearing your feedback! I’m new to DOTS so I’d like to be aware of things I can do better before going too far with this.
NativeArray<Entity> eventEntities = eventQuery.ToEntityArray (Allocator.TempJob);
for (int i = 0; i < eventEntities.Length; i++)
{
EntityManager.DestroyEntity (eventEntities[i]);
}
eventEntities.Dispose ();
You can use EntityManager.DestroyEntity(eventQuery) instead of looping each entity. Much faster using the batch version since it effectively destroy the chunk(s) the entities are in.
Btw, your Scriptable Framework looks interesting, will take a deeper look!
Thanks for that @Singtaa ! Scriptable Framework is another interpretation of Scriptable Object Architecture but ECS is equally modular so the framework is only applicable to monobehaviour projects.
I’m hoping there could be a render texture API supported by DOTS since the biggest performance hit on my point cloud system is the wait between dispatching the compute shader and the work needing to finish on the same thread. Or am I misunderstanding something?
It looks like you are reloading the compute shader and render texture each frame. Try caching those in the OnCreate. Liewise, try caching your data writer in OnCreate as well since that is a class type and you are generating it every frame.
Also, why are you dispatching the compute shaders to work on a temprorary render texture just to copy it into the real texture? And why are you flushing the graphics pipeline? Pretty much all the Graphics API use an internal command buffer and dispatch to the GPU. CopyTexture included.