Manual Cull Hit / FrustumIntersect

Hi Guys,



I am working with some procedurally generated geometry. I have implemented a simple way of generating them on the fly in the game loop, based on distance. ( The nearest ones to the camera generates first. )



Now I wanted to add a bias to make geometry in front of the camera generate with higher priority. My approach to adding this bias is simple, yet it does not work. Here is my method for scoring the geometry:



[java]

FrustumIntersect intersection = camera.contains( geometry.getBound() ); // Using estimated bounds

float bias = 1; // Base bias for geometry outside the view frustum

if( intersection == FrustumIntersect.Inside )

bias = inside_bonus; // High bonus for geometry inside the view frustum

if( intersection == FrustumIntersect.Intersects )

bias = intersect_bonus; // Medium bonus for geometry on the border of the view frustum



float local_score = max_render_dist - this.distanceToGeometry( camera.getLocation(), geometry );

local_score *= bias;

}

[/java]



I checked the FrustumIntersect results, and it turns out that it always comes out as “Inside”, which is impossible. I have confirmed that my “estimated bounds” are correct and I have also confirmed that geometry is in fact behind the camera.



Does anyone have an idea what I am doing wrong, or maybe another approach?



Cheers,



NiHal

Noone has an idea on how to do this? All I need is a way to check if an object is inside the view of the camera…?

Here I posted how to find out which items are in a “rubberband” box selection, same applies for the frustum in general, its a pyramid:

http://hub.jmonkeyengine.org/groups/graphics/forum/topic/how-to-select-multiple-3d-objects-programatically/

1 Like

Thank you for the suggestion. I did not get around to trying things out until today.



Works like a charm, cheers!