Say I have a UI looking like this …
| * | |
| * | A |
| * | |
| B | ******* |
… where A and B are usually the only areas displaying 3D content, and that content better belongs to the same scene.
There seem to be a few options:
- 1 canvas, 1 scene, 2 viewports (+ masks if needed)
- 1 canvas, 2 scenes
- 2 canvas, 1 or 2 scenes
The last option is off the table for performance reason I guess (as per the documentation).
Using viewports is currently my preferred choice, as the content displayed in A and B is coupled. Also, this approach allows me to have A covering the entire screen real-estate if needed, with B displayed on top of A.
I wanted to check with the pros if the apparent waste of canvas real-estate can have an impact on performance and if so, what might be a better approach.
I think it depends on the content being displayed in A and B. is there an overlap of meshes (or assets) between A and B, or are they displaying a whole different set of resources?
You would anyhow be forced to set the viewport, so the only different is the organization of your data and resources reusability IMO
In my current project the two sets of objects don’t overlap: area B is basically a 3D compass, which orientation is kept in sync with A.
So if I interpret your reply correctly, as far as performance is concerned:
- there is no difference between the two approaches.
- the canvas area not belonging to any viewport is not a factor.
Yes and no! it really depends on your structure, but IMO a new scene that renders the compass only would probably behave better
Correct. Only the viewport area is being rendered.
Do you think you could give a couple of examples where execution performance would be impacted with one approach more than with the other? So I can use that as a starting point to educate myself on the multi-scene topic?
I guess it’s all about how you render the 2nd viewport. If you need to disable many meshes except for the mesh(es) that should be rendered in the 2nd viewport then there might be an impact on performance.
Eventually - you will run the render loop twice. either 2 cameras, or two scenes (with a camera each :-))
Ah… I think I see where you’re going with this. Thanks!