Search Unity

Get visible vertices?

Discussion in 'Shaders' started by amasinton, Aug 23, 2016.

  1. amasinton

    amasinton

    Joined:
    Aug 12, 2006
    Posts:
    138
    I would like to change the color of mesh vertices that are visible to the camera.

    Could this be done with a shader?

    That is, could a shader report which vertices are visible to the main camera in such a way (perhaps by returning vertex index number?) that would allow me to then change the color of those vertices permanently using a script?

    Or, is this something best done without shaders?

    So far, I've only come up with the rather inelegant and inefficient approach of checking whether each vertex in a mesh is within the viewport (but this doesn't take into account whether a vertex is occluded).

    Thanks hugely for your thoughts!