i am very new to unity. And i may misunderstanding some of basic concept, i will try my best to explain my problem. and thank you for your helping
i have an (single) imported 3d object contrain mesh(vertice). i want to know the how many mesh which viewed by the main camera and how many didn’t like digram it showsthis
i was doing some likethis from other.
However it gives full meshes when camera is looking at the object. i guess because it is perspective, so the camera can look through the object mesh at “behind”
i am wondering is it posiible or any API allow the camera to get the mesh(list) what it seen, maybe something related to raycasting?
Yes, you would have to use raycasting in order to get a precise result. Technically all the vertices and faces of a mesh are rendered. So it doesn’t matter if there are faces that are off screen or behind other faces.
So you can raycast against every vertex in your mesh to see if the ray can actually reach the vertex or not. Since casting rays against the corners of a mesh can easily miss the mesh completely, you should just cast a ray with the exact distance to the vertex. You reach the vertex if the raycast did not hit anything or if the hit position is within a certain threshold of the actual vertex position. If the hit position hit earlier we can conclude that this vertex can not be seen.
Though in addition to the raycast you also want to do a camera frustum check like they did in the linked question. You would only test the vertices that are within the camera frustum