[Bf-committers] Knife tool and perspective mode -- incorrect
joeeagar at prodigy.net
Mon Nov 8 04:05:38 CET 2004
Matthew H. Plough wrote:
> Matthew H. Plough wrote:
>> <snip>I am currently working on fixing seg_intersect to make this
>> work properly. <snip>
> I have written intersection code that does not use screen coordinates,
> but I am having trouble transforming screen coordinates to certain
> scene coordinates.
> Essentially, I need to transform the screen coordinates of mouse
> clicks to scene coordinates on the image plane in perspective mode.
> For a camera view, this corresponds to coordinates within the
> rectangle on the front of the camera with the arrow pointing up. Does
> anyone know how to do this? I spent quite a bit of time perusing code
> and algorithms in books, and did not find anything.
I tried this once for the new Transform() refactor, but I could never
get it to work. Basically my idea was to multiply the screen
coordinates by the camera's view matrix, then multiply them again along
the camera's view vector until they intersect with the transformation
center, then multiply them *again* by the perspective matrix.
However, I have to admit that my knowledge of matrix math is limited,
and I never could find a clear definition of the view and perspective
matrices (google, you have faaaiiilleed me!), and this never worked for me.
You might also want to try using the selection buffer. It's not all
that difficult, try looking at the Programmers Guide to OpenGL on
opengl.org. It says how to use a backbuffer for z-buffered selection,
too. Plus find the function mouse_mball in the the code, and it will
contain the Blender function for accessing the selection buffer. It's a
really wierd name, like Projikc_something.
P.S.: I sometimes have bad luck with Google, so if you type in
"perspective matrix" and the first page is a clear, consise
definitition, please don't blame me.
More information about the Bf-committers