You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Icons - is a useful visual tool for selecting entities and delivering some information based on viewport, for example icons for light sources that have no models, or script entities.
While it is a useful tool, it is implemented in a bit "brute-force" manner. Which basically creates a plane entity for each entity in scene, and updates it every frame. Even if the icon is disabled, or not even visible (e.g. when entity has render component).
In projects with thousands of entities (we have projects with 10k+), this leads to a significant performance hit.
So here are a list of issues:
It creates an entity for each entity in scene.
It renders it as a separate draw call (render component with plane primitive).
It iterates through all icons every frame to identify a need of update.
It can take half of a frame time during rendering on just icons processing.
How to improve:
Use instancing for rendering quads.
Consider using PRIMITIVE_POINTS, although it will have a limit on icon size on the screen based on resolution, so two triangles might be better.
Orient icons towards the camera in vertex shader.
Make sure instance buffer data is very slim (just position, and index of icon within atlas).
Use atlas texture for icons, so that all different icons - can be drawn as a single instanced drawcall.
Update icons using mostly events.
For cases when update of icon won't be possible using an event, implement immediate checks for icons of selected entities on every frame.
For not selected entities, for icon updates that cannot be done using events, make sure it does run not on every frame, but with some periodical delay (not more often than one update on every 200ms). Ideally it would not iterate through all icons, but only visible and potentially in chunks.
If in Editor settings "Icons Size" is 0 (disabled), ensure there is no extra work and overhead from icons.
The text was updated successfully, but these errors were encountered:
There are solutions for sure to handle it. Just saying that i'd need more work to manage IDs even. Currently we use meshInstnce.id as it's id. We'd need to allocate range for instances and similar.
Icons - is a useful visual tool for selecting entities and delivering some information based on viewport, for example icons for light sources that have no models, or script entities.
While it is a useful tool, it is implemented in a bit "brute-force" manner. Which basically creates a plane entity for each entity in scene, and updates it every frame. Even if the icon is disabled, or not even visible (e.g. when entity has render component).
In projects with thousands of entities (we have projects with 10k+), this leads to a significant performance hit.
So here are a list of issues:
How to improve:
The text was updated successfully, but these errors were encountered: