I find it difficult to determine what is the best way to check if a 3D object is visible to the camera’s eyes.
I have a sphere in the middle of the screen. Some cubes are added to the surface randomly. I need to check which cubes are visible (on the front half of the sphere) and which one is invisible (on the back half of the sphere) for the camera’s eyes.
What I have found so far seems to be the right direction, but I have to miss something with the THREE.Raytracer class.
Here is the code script I am using: jsfiddle . I tried to make this as clear as possible.
This part of the violin may contain an error code:
var raycaster = new THREE.Raycaster(); var origin = camera.position, direction, intersects, rayGeometry = new THREE.Geometry(), g; pointGroup.children.forEach(function(pointMesh) { direction = pointMesh.position.clone();
Frustum Culling is not working as described in this question here: post1
Also this post2 and this post3 explain the topic really well, but not quite for this situation.
Thanks for the help!
hetsch
source share