[ODE] A trimesh-as-view-frustum question
Colin Bonstead
colin at cyan.com
Thu May 6 14:36:18 MST 2004
Nope, it doesn't. To do that it would need to use hulls, which have a
definite inside and outside.
-----Original Message-----
From: Shamyl Zakariya <zakariya at earthlink.net>
Sent: Thu, 6 May 2004 17:19:40 -0400
To: <ode at q12.org> <ode at q12.org> <ode at q12.org>
Subject: Re: [ODE] A trimesh-as-view-frustum question
Well, that makes sense!
I'll have to give it a shot and check to see if the overhead of
calculating this is countered by the speedup of not drawing invisibles.
Anyway, I'd still like to know if opcode will detect if an object is
entirely inside, and not intersecting edges.
shamyl zakariya :: lorem ipsum dolor sit amet,
On May 6, 2004, at 4:06 PM, gl wrote:
>
> Far too much work. You can extract your camera's view frustum planes
> quickly using this:
> http://www2.ravensoft.com/users/ggribb/plane%20extraction.pdf
>
> Then you test eg. AABBs against the frustum's planes:
>
> // Initialize the intersection indicator.
> vec3 min_extreme, max_extreme;
> bool intersect = false;
>
> // For each of the six frustum planes
> for (int i=0; i<6; i++)
> {
> // Find the minimum and maximum extreme points along the plane's
> // normal vec3. Just understand this normal as a line of all
> // real numbers. 0 then lies on the plane, negative numbers are
> // in the halfspace opposing the normal, and positive numbers
> // are in the other halfspace. The terms "minimum" and "maximum"
> // should now make sense.
> // for each component x, y, and z:
> if (Plane[i].Normal().x >= 0.0f)
> {
> min_extreme.x = b.min.x;
> max_extreme.x = b.max.x;
> }
> else{
> min_extreme.x = b.max.x;
> max_extreme.x = b.min.x;
> }
> if (Plane[i].Normal().y >= 0.0f)
> {
> min_extreme.y = b.min.y;
> max_extreme.y = b.max.y;
> }
> else{
> min_extreme.y = b.max.y;
> max_extreme.y = b.min.y;
> }
> if (Plane[i].Normal().z >= 0.0f)
> {
> min_extreme.z = b.min.z;
> max_extreme.z = b.max.z;
> }
> else{
> min_extreme.z = b.max.z;
> max_extreme.z = b.min.z;
> }
>
> // If minimum extreme point is outside, then the whole AABB
> // must be outside.
> if (Plane[i].DistanceTo(min_extreme) >= 0.0f)
> return FULLY_OUTSIDE;
>
> // The minimum extreme point is inside. Hence, if the maximum
> // extreme point is outside, then the AABB must intersect with
> // the plane. However, the AABB may still be outside another
> // plane.
> if (Plane[i].DistanceTo(max_extreme) >= 0.0f)
> intersect = true;
> }
>
> // The AABB is either partially or fully visible.
> return intersect? PARTIALLY_CONTAINED : FULLY_CONTAINED;
> --
> gl
>
> ----- Original Message -----
> From: "Shamyl Zakariya" <zakariya at earthlink.net>
> To: <ode at q12.org>
> Sent: Thursday, May 06, 2004 6:17 PM
> Subject: [ODE] A trimesh-as-view-frustum question
>
>
>> I have a couple quick questions about OPCODE.
>>
>> First, if I were to have a large geom, say a cone or a pyramidical
>> section described as a trimesh, would OPCODE detect when an object is
>> completely inside? Or does OPCODE only detect intersection with the
>> surface triangles?
>>
>> Second, if the first is true, I'd like to know what your collective
>> thoughts are on using a trimesh view-frustum for visibility
>> determination. As in, if I had a trimesh corresponding to my view
>> frustum with my camera's position and orientation moving and
orienting
>> the trimesh, would it be an effective way to determine which objects
>> in
>> my simulation are visible?
>>
>> As I write this, I seem to recall that there are ( or were ) problems
>> with moving trimeshes -- it that still the case?
>>
>> I'm just curious. My simulation has a fairly rich environment so my
>> simulated robots have a lot to interact with. But my laptop is a
>> fairly
>> anemic 800mhz powerbook, so while I've put a lot of work into
>> optimizing my OpenGL calls, it would speed things up significantly to
>> be able to only draw those objects which are visible, and that of
>> course would leave more cycles to my AI. But since the AI work is
more
>> important than the visualization I wouldn't want to spend an
>> inordinate
>> amount of time on a *real* visibility determination system. The
>> view-frustum as a trimesh geom approach seems like it would be fairly
>> easy to implement, providing of course that it would work ;)
>>
>>
>> shamyl zakariya :: lorem ipsum dolor sit amet,
>>
>> _______________________________________________
>> ODE mailing list
>> ODE at q12.org
>> http://q12.org/mailman/listinfo/ode
>>
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode
More information about the ODE
mailing list