Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Hide the line drawn by LineRenderer with a 3D model

Discussion in 'General Graphics' started by nax_unity, Oct 19, 2020.

  1. nax_unity


    Jan 24, 2018
    I'm drawing a parabola with LineRenderer
    The line is displayed without being hidden behind the fence of the baseball stadium.

    The fence has a model created with "Pro Builder".
    Even if the camera is placed behind the fence, it does not hide only the back of the fence.
    The camera angle is tilted by 50 °.

    I used "Line Renderer" for parabolic drawing, do you know any solution?

    Development environment
    Unity 2018.4.22f1
  2. richardkettlewell


    Unity Technologies

    Sep 9, 2015
    The line will be depth-sorted with all other objects, so this is more a question of how your materials are set up, rather than a line renderer setting.

    Using an opaque shader will make all parts of the line sort correctly with opaque 3D models, but transparent objects cannot be sorted per-pixel, so must appear entirely in front or behind other transparent objects. The default line material is transparent, perhaps you could use an opaque material instead, such as the Standard Shader (or URP/HDRP equivalent).

    If the 3D object is opaque and the line is transparent, you should also get correct per pixel sorting automatically.
    BMRG14 likes this.