Search Unity

How to set custom bounds without creating a new mesh

Discussion in 'General Graphics' started by stephero, Oct 27, 2020.

  1. stephero

    stephero

    Joined:
    Feb 8, 2016
    Posts:
    123
    Hi guys,

    Let's say I have a cube. I apply vertex displacement on this cube through a shader so the vertices are sometimes out of the original cube's bounds.

    When rendering it, sometimes the cube disappears when almost out of the frustum: I need to set custom bounds to properly render it.

    The only writable bounds property I can find in the API is on the Mesh itself. Do I really need to create a new Mesh object to have custom bounds? Is there a way to set custom bounds higher in the hierarchy, like on the MeshRenderer or MeshFilter?

    Thanks