I have a problem with the intersection with the frustum of the camera
I want to use the camera’s frustum to determine whether objects are inside or outside of the camera.
I created a camera by specifying the following values:
Camera cam = new Camera (1024,768); cam.setLocation (_positionLight); Float near = (pVoxel.distance (_positionLight)) - 0.5f; Cam.setFrustum (near, _distanceMax, -0.5f, 0.5f, 0.5f, -0.5f); Cam.lookAt (pVoxel, new Vector3f (0,1,0));
PVoxel : is the position of my cube that must block light
Near : is the distance between my light and the cube, it is the place of the plane of the frustum
I do this to determine if an object is behind a cube that is illuminated by a light source. If the object is in the frustum, I generate the mesh with a suitable vertexcolor (simulation of the shadow).
In order to verify that my frustum corresponds well to the projection of my light, I have drawn lines from my position of light to the nearest points between the voxel and the frustum planes.
Everything seems correct.
I then use a boudingBox or a boundingSphere to test whether the object behind my voxel is inside the frustum or not.
I save the state of the plan of the boudingvolume before testing whether it is contained in the frustum as indicated in the documentation
Unfortunately, the method contained in the camera object does not seem to work.
Can you help me ?
Here below a video showing what I try to do, cubes are shaded while their boudingbox is not in the frustum