No, no they are really not much use at all. They take too long.
Object picking is best done using the clipping hardware. Every 3D API
has a clipping API that uses the clipping hardware to do picking.
Lighting is best done using the rendering hardware to do the lighting
based on the surface normal of the thing being lighted.
Incorrect. In fact, the selection and feedback API has been removed from
OpenGL as of version 3.0, and hasn’t been updated since OpenGL 1.0 or so.
Even on those platforms where it is still supported, It runs on software,
and in most cases it runs slowly on software because nobody uses it any more
and there’s no support for it in hardware. So, no, this is not an
appropriate choice.
That is a damn shame. I didn’t know I was that out of date on those
APIs. Back in the bad old days you could very efficiently set up a
clipping volume, send a set of primitives down the pipe and get back
the ones that intersected the clipping volume. You could do that with
out every drawing anything and it was (it still should be) much faster
than than doing the same thing in software.
The traditional method for doing this in a modern application is, indeed,
ray casting, and Brian Hook has kindly posted a very good explanation of the
technique here: http://bookofhook.com/phpBB/viewtopic.php?t=485 (Obligatory
Disclaimer: I checked the math, but I am credited as Nichola Vining for some
reason.) If you’re worried about speed, then yes, you use bounding
primitives and an acceleration structure. Bounding primitives are a good
idea; an acceleration structure may be overkill depending on how few things
you have on the screen.
The question of whether there is line segment that connects to points
without passing through another object is also best done by clipping
to volume that contains the two points and all points in between.
Anything that isn’t clipped out is possibly in the way.
It is unclear what you’re talking about here, but I certainly wouldn’t use a
clipping approach (at least in the sense of the Sutherland-Hodgman
Funny you should mention Hodgman, I used to work for him. Best
technical/product development manager I ever met.
algorithm, which is the standard algorithm for clipping things (lines?
polygons?)) I would just shoot a ray through the world, see what it
intersects, and then see if the point of intersection that occurs with
anything in the world appears between the two points on the line that we are
concerned with. If you want a line segment, remember from high school
mathematics that a line in space is defined by the equation L = o + td where
t is a scalar, bounded between two values t0 and t1, and o and d are
vectors. Simply do your line/everything intersection as per normal, and then
see if your intersection point falls between the values of t0 and t1 for
your line segment.
David Eberly’s book “Geometric Tools for Computer Graphics” is an extremely
good reference for intersection tests. Another useful resource is the
complete guide to How To Intersect Anything With Anything Else at
?http://www.realtimerendering.com/intersections.html
N.
You use the term “ray casting” for testing a ray against a data
structure that represents your graphic world. That’s fine. Let me
describe in a little more detail what I was talking about. Basically,
how do you do that ray casting.
First thing you have to do is find the primitives that might intersect
the ray. You can use any kind of data structure you want to accelerate
the process. The right data structure lets you drop from O(n) to O(
log n) and might let you get down to constant time. This process is
part of the clipping path in any rendering pipeline. The second part
of the process is detailed clipping. That is where you use something
like Sutherland-Hodgman to clip the primitives to the actual clipping
volume. The whole process is called clipping. No matter where you stop
it, you wind up with a list of primitives that you can check your ray
against. But, you only want to do the check against the ones that are
likely to intersect the ray.
You said, “shoot a ray” and then talked about bounding primitives and
I said “The question of whether there is line segment that connects to
points without passing through another object is also best done by
clipping to volume that contains the two points and all points in
between. Anything that isn’t clipped out is possibly in the way.” The
clipping volume is a bounding primitive. The stuff that is possibly in
the way is the stuff you have to intersect with the ray (line segment)
to see if there is an intersection.
When you are rendering an image the clipping phase often also includes
things like back face culling and the use of a z-buffer (yes, the
z-buffer is part of the clipping system. At least from my point of
view).
Assuming you that you are the Nicholas Vining I just looked up on
Linkedin then congratulations on your MSCS. I got mine in '85. It is a
good degree to have.
Bob Pendleton.On Sun, May 1, 2011 at 3:11 PM, Nicholas Vining wrote:
On 4/30/2011 4:22 PM, Bob Pendleton wrote:
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
–
±----------------------------------------------------------