View Full Version : Trouble w/ Matrix in Renderman Coding
artistx 10112002, 09:49 PM I'm looking into the Renderman Shading language and I just came across the subject of matrix transformations. I know how to solve a matrix or the inverse of a matrix, but i can't seem to see how these apply to 3d transformations and mapping. Is there anyone here who can explain how the matrix works in 3d. I would prefer a visual representation as I've read many explanations that only use words. The visuals would probably help me break through that comprehension barrier. Perhaps someone could point me in the right direction for books that have charts or diagrams of some sort. Thanks. I'd really appreciate it. :)


Mauritius
10122002, 10:49 PM
There are dozens of books on the subject. "Linear algebra" is the term to look for.
Either consult you library/bookstore or do a search on google but an introduction to the subject is beyond this forum.
It's a bit like asking someone to tell you how to use Maya or Max. That's what the manuals are for. ;)
The "Advanced RenderMan" book by Griz et al has a short introduction to the math but it is not enough if you don't have basic insight into the subject matter.
Cheers,
Moritz
artistx
10132002, 10:52 AM
Thanks for the help Mauritius. Something told me you would be the ~only one that would reply. :)
I didn't realize the matrix math was such a huge field. After looking around for info I found this subject to be large in scope. I can solve the simple matrices, but I discovered I need to learn 2 dimensional matrices then I'll graduate up to 3 dimensional matrices. I also have a general understanding of where to enter specific data into a 3 dimensional matrix now. (i.e. rotations go in a certain place. translations are entered at the bottom of the matrix. etc.) The subject has given me enough trouble that I might put up a web site for those who want to understand the basic concept of matrices and their usage in Renderman. I know it has already been done, but I figured I might add a new angle to explaining the subject.
By the way, I have a Maya2XSI site up which translates Maya interface functions into their XSI equivalent. Check it out when you get the chance.
Here's the site> www.artistx_000.gullickson.com
Mauritius
10132002, 07:58 PM
I'm not sure what you mean by "solving the matrix". Anyway, there is a nice quick intro in the latest RMan coursenotes from SIGGRAPH 2002 by Tony Apodaca, called "The Lore of the TDs":
http://www.renderman.org/RMR/Books/sig02.course16.pdf.gz
If you're using IE (which is a baaaad attitude), note that it decompresses the GZip on the fly and hence you only need to rename the file to .pdf when it arrives at your HDD.
The article starts on page 7 of the PDF resp. page 1 of the document.
Cheers,
Moritz
artistx
10142002, 03:46 AM
Lol, yes Mauritius. "Solve a matrix" doesn't quite make sense. In other words, I'm saying I can add and subtract matrices to get the resulting matrix. For example, matrix A + matrix B = ans. . I'm sure you were thinking before, "but you don't really solve things within a matrix, you solve things between matrices OR you use matrices to transform vectors." On top of that, you can do more than add and subtract matrices. Please excuse the ambiguous statement "solve a matrix". I should have known better.
Thanks for the additional info. I'll look into that course chapter for more help.
Mauritius
10142002, 03:40 PM
Usually you transform points, vectors or normals by matrices. Seldom do you actually 'build' matrices from scratch in a shader.
But to do this in a shader in RMan SL, you don't need to have the slightes clue how it works internally. All you need to understand is coordinate systems and local spaces.
A command like
transform ("myspace", myvar);
does all for you and even takes the right measures, depending on the type of 'myvar'  point, vector or normal.
Coordiante systems can be defined in a RIB at any time, e.g.:
TransformBegin
CoordinateSystem "myspace"
TransformEnd
This saves the current transformation matrix as "myspace" for further reference in a shader.
The transform() function uses named coordinate systems or (probably implicit defined) variables of type matrix interchangeably.
Matrices can be multiplied by plain using the '*' operator. Using the '/' multiplies by the inverse of the matrix given as the second operand. The inverse of a matrix itself is thus written as
1/mymatrix
The comp() and settcomp() functions work with matrices and there is one function, determinant(), that should be fairly self explanatory.
Using the translate(), rotate() and scale() functions, you can concatenate these transformations onto a matrix.
As you see, no deep math knowledge is needed, nor even the understanding of matrices per se. All you need to grasp, as a start, is that a matrix can hold a descriptin of how a space is aligned in another space.
.mm
CGTalk Moderation
01132006, 08:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©20002015, Jelsoft Enterprises Ltd.