Determine if a spatial is going to be culled by near plane

Hi,

I wanna know how I can determine if a given spatial is going to be culled by the near plane. Is there a simple way to test this?



Let say I have a sphere with radius 5 and near plane at 1 and now I want to find if the frontfaces of this sphere are going to get culled or not.

Maybe that could help…



From the Javadoc…



public boolean checkCulling(Camera cam)
checkCulling checks the spatial with the camera to see if it should be culled.
This method is called by the renderer. Usually it should not be called directly.
Parameters:
cam - The camera to check against.
Returns:
true if inside or intersecting camera frustum (should be rendered), false if outside.

Yeah, just check if its culled and closer than 5

Thanks, will try that when time allows :slight_smile:

Hi,



a small hint: The method checkCulling manipulates the state of the spatial and the cam - i dont know if it has sideeffects, for example if you call spatial.checkCulling the variable frustrumIntersects is changed. If you use multiple different cameras i dont know if this has a sideeffect on runtime during the normal rendering…



In “camera.contains (BoundingVolume)” the cameras planestate is manipulated. I think this is due to speed optimizations.

I used a camera.setPlaneState(0) before check the culling of another spatial with that camera like that one:

[java]

for(Spatial s : spatials){

cam.setPlaneState(0);

if(s.checkCulling(cam)){

// Do sth

}

}

[/java]



Regards