How does the 2D screen handle being updated every frame?
In relation when done in Unity if one transform moves the entire canvas is marked as dirty and all elements are recalculated and rendered making it an extremely inefficient option for device. This can be worked around by adding a sub-canvas to the parent of the objects that are constantly moving making only them getting recalculated instead of the entire canvas.
Does Playcanvas work in a similar way?
The Playcanvas UI elements are rendered using a special pixel shader. There aren’t any 2D/Canvas operations which makes them pretty fast.
I think there are still optimizations, like the scene hierarchy/entities to avoid world matrix updates if nothing has changed. From my experience it is quite fast.
like the scene hierarchy/entities to avoid world matrix updates if nothing has changed
Are you able to explain a bit more on this?
On each frame not all entities get updated (translation matrices) but only those that have moved/rotated/got scaled and their children accordingly.
The same holds true for the UI elements since they are based on regular entities/graphNodes.
So when those changes are made to any of the object does it require a full repaint of the 2D Screen?
Actually there isn’t any repainting happening on the 2D screen in a sense that special/costly 2D operations need to happen.
The 2D screen is updating in the same manner as the 3D scene since it’s using entities/graphNodes and material/shaders. I wouldn’t worry so much of performance here, it should be quite fast in most cases.
Right so the 2d screen is always painted same time as the 3d world and when objects are moved only the transforms are recalculated.
So 2d screens and the 3d world have the same performance costs when moving objects in the world - fascinating.
That helps a lot