Not sure if my question is stupid. Im new to dots 
In the unity doc about transform concepts it says that localtoworld component is used for rendering the geometries. As well as its possible to remove automatic update from localtransform to localtoworld.
So can I remove localtransform from my entities and just update the localtoworld transform? Entities dont have colliders so its only about rendering.
And if so, how do i remove the localtransform? Maybe use different allocator in GetEntity?
Guess you could just try it. If its renders it works.
I would start by just accepting the basic setup and see if you can make your game with it. And once you feel comfortable with DOTS see if there is performance to be gained from removing a component.
Because the entity limit per chunk is low now because of enable component mask, fat entities with lots of data don’t perform worse in most cases. As far as I know.
I dont want to build a game. My plan is a 3D Boids simulation, optimized for performance.
So every small performance improvement is helpful.
Just saw I can use GetEntities(TransformUsageFlags.Renderable). With this the entities will only get a localToWorld component. Is there some extra cost with setting the localToWorld directly each frame? For example unity optimizes rendering with the assumption of fixed entity positions.
1 Like
Incorrect. It matters a lot. The change with enabled components only caps the benefit, but that only really applies for entities that don’t have transform components at all. As soon as transform components get involved, the budget to even fit 128 entities in a chunk becomes really tight. In my framework when using a custom transform system that only uses 48 bytes for root entities, entities with just the transform and rendering components require 124 bytes, which is only 4 short of the 128 byte budget you have to fit a full 128 entities in a chunk.
Also, cutting out the job that converts local transforms to matrices is a pretty big performance win.
As long as you set up the LocalToWorld at the same time you are updating the positions, so that all the data is already in cache and you are just adding a few extra computations, then this is probably going to be a lot faster. As for Unity’s optimizations, it is entirely based on change filters. If you have entire chunks of entities who don’t need their LocalToWorld updated, make sure to skip requesting write access to them. You can do this with IJobChunk or IJobEntityChunkBeginEnd to early-out/skip chunks.
2 Likes