Advertisement

raytracing

Started by May 10, 2003 09:36 PM
3 comments, last by vanillacoke 21 years, 9 months ago
Does anyone know of efficient way to transform a point in object space to a point in screen space for an arbitrary viewplane in space? I know I could just intersect a line and a plane, but I''m looking for a more efficient, eloquent way to do it.
You know what I never noticed before?
If you know the orientation of the viewplane relative to the same coordinate system that the point is defined in, you can create a transformation matrix for the viewplane----basically a world to viewplane matrix. Then postmultiply that transformation matrix by the point.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Advertisement
"If you know the orientation of the viewplane relative to the same coordinate system that the point is defined in, you can create a transformation matrix for the viewplane----basically a world to viewplane matrix. Then postmultiply that transformation matrix by the point. "

Now I know why I never became a chief scientist..... I LIKE people understanding what I say.

Postmultuply?

Is that sending a chain letter on to 27 of my friends?




Stevie

Don''t follow me, I''m lost.
StevieDon't follow me, I'm lost.
My apologies for writing a very quick reply that did not take the time to define the terminology used in a tutorial fashion. I was only trying to help, and simply did not have much time to dedicate to a reply to your brief question. Keep in mind that ALL replies to this forum are on a 100% volunteer basis, so be happy for anything you get. If you read my other posts I believe you will find I am quite capable of writing words that are easier to follow, though I do tend to write for late high school or college audiences at the youngest.

This reply isn''t likely to be much easier for you to follow, but it should at least point you more in the direction you need to be headed.

If you are going to do elegant 3D math it will help if you know the terminology. "postmultiply" is standard terminology in 3D graphics. To postmultiply a matrix by a vector means to take the matrix and multiply with the vector (or perhaps another matrix) on the right-hand-side, as below:

M = matrix
V = vector

postmultiply result (a vector) = M * V;

So "V" is on the right side of "M"----it is written "post" or "after" M.

Now, if you were to "premultiply" the matrix by V, you would
have:

premultiply result (a vector) = V * M;

[technically this should be transform(V) * M]

where V occurs "pre" or "before" M.

In case you don''t know, M * V and V * M (or transform(V) * M) provide different results, thus the need to distinguish between the two.

The eloquent solution you are looking for lies in this matrix and vector math. The matrix represents the rotation (and translation as well if you''re using "homogeneous" coordinates) of your arbitrary viewplane. The postmultiply is the thing that does your eloquent transformation.

Unfortunately I just don''t have time to put together a thorough tutorial for beginning 3D programmers right now. But I can point you to a few resources. The classic book by Foley, van Dam, etc., "Computer Graphics: Principles and Practice, Second Edition" will talk about all this math, and will provide equations. There are also articles on the web including a few here on gamedev.net:

http://www.gamedev.net/reference/articles/article1832.asp

http://www.gamedev.net/reference/articles/article1691.asp

http://www.doc.ic.ac.uk/~dfg/graphics/GraphicsLecture04.pdf


Do not be afraid to experiment, and run examples from the references.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
vanillacoke, I realize it was not you who wrote that reply. They touched a nerve, that's all.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

[edited by - grhodes_at_work on May 16, 2003 4:11:52 PM]
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement