Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 27 July 2011 - 05:33 PM
Posted 27 July 2011 - 07:52 PM
Posted 27 July 2011 - 09:21 PM
Posted 28 July 2011 - 08:19 AM
I'm sorting all my transparent objects by distance from the camera so they can be drawn correctly.
Posted 28 July 2011 - 07:20 PM
See this page , section "Distance between lines, rays, or segments and boxes (3D). "
Try to use the distance to the near plane, not to the camera position. Often the distance to the object center is good enough, but if it isn't you can use it's bounding volume.
float distance = Vector3.Dot(plane.Normal, aabb.Position) - plane.D;
float r = Math.Abs(aabb.Extents.X * plane.Normal.X) + Math.Abs(aabb.Extents.Y * plane.Normal.Y) + Math.Abs(aabb.Extents.Z * plane.Normal.Z); float distance = Math.Abs(Vector3.Dot(plane.Normal, aabb.Position) - plane.D - r);
Posted 29 July 2011 - 06:47 AM
Can some please explain how I can obtain the distance between the closest AABB face and a plane? In other words the distance between the closest point on the AABB to the plane.
Posted 29 July 2011 - 07:07 AM
Surely for a convex shape like a cube it'll be one of of the corners (the points on the face will never meet the plane independently of the corners) - So just do point-to-viewplane distances for all 8 corners (and choose the smallest positive distance)?
Returning to the transparency sorting - do your objects overlap or inter-penetrate?
Posted 29 July 2011 - 01:34 PM
Posted 30 July 2011 - 04:38 PM
Iam still going with my initial suggestion of find the value T or D from the Ray to the Walls of the AABB. The shortest one is closest to the screen.
Posted 03 August 2011 - 11:24 AM
Iam still going with my initial suggestion of find the value T or D from the Ray to the Walls of the AABB. The shortest one is closest to the screen.
I don't understand how that will work correctly. Forgive me if am being dim but a ray cast from the camera along its forward vector can easily miss a side of the AABB if that side is (almost) parallel to the ray.
What advantage does the ray to plane distance test have over the corner to near plane distance test in this case?
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.