Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Feedback Ability to define vanishing point for 3D UI content?

Discussion in 'UGUI & TextMesh Pro' started by Peeling, Jun 28, 2021.

  1. Peeling

    Peeling

    Joined:
    Nov 10, 2013
    Posts:
    443
    Including 3D content in a canvas is, to put it mildly, a bit of a ball-ache.

    If orthographic projection is acceptable, and the objects don't have to sort in amongst other UI content, it's not too bad. But if you want to present 3D objects with perspective, and not have them distort excessively when they are at the edge of the screen, prepare for some bean-bag abuse.

    The solution we've ended up running with is to place all the 3D content off-screen, and then configure a custom camera pointed at each one, with code to constantly adjust that camera's viewport and projection matrix so that the rendering area corresponds to the desired image area within the UI, and the vanishing point corresponds to the centre of that rendering area. This is expensive and awkward, especially when it comes to dealing with rendering areas that partially leave the screen.

    It would be marvellous if there were a component that could be dropped onto a transform in the canvas hierarchy which would automatically define the vanishing point for all 3D children. Or, even better, a new camera type that would automatically render just its 3D children to the region occupied by the rect transform it's attached to. I'm constantly running out of layers to hide things from different cameras.