Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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:
    416
    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.