PDA

View Full Version : Camera(View) and World transforms



09-30-2000, 02:13 PM
Suppose I set my world transform to the
identity matrix, and only use the camera
transform for moving around. Would drivers
optimize for this case, and avoid having
to run the second (world) transform on my
geometry?

Or do the drivers just remember what the
camera transform is, and only keep a merged
world transform that they apply no matter
what? (Actually, that would be smarter. I
think I don't need an answer now, but I'll
ask just to make sure :-) )

Bob
09-30-2000, 02:46 PM
Think you are messing some things up here. There are only three matrices in OpenGL. They are called modelview-, projeciton- and texture-matrix. What you (probably) mean as camera transform and world transform is the same thing, it's the modelview matrix.

All transformations you do should be applied to the modelview matrix. This includes camera movements (actually, there's no such thing as camera, you only set the current viewpoint which is located at the origin looking down the Z-axis with Y-axis as upvector) and all object specific transformations.

[This message has been edited by Bob (edited 09-30-2000).]

10-02-2000, 09:18 AM
What I mean by "camera" is the projection transform.

Anyway, it would only make sense for the driver to only keep
one "cumulative" transform matrix active, and re-create it
whenever any of its parts changes.

Bob
10-02-2000, 10:00 PM
No, this doesn't make sense. Because lightning and sphere mapping (in the core at least, probably some more functions in extentions too) is performed BEFORE projection.

onyXMaster
10-04-2000, 02:20 AM
Yeah, you should never use projection matrix for something different than projection.
About transforms - AFAIK cards can keep transformed vertex data if you tell them it is a one block.
Here EXT_compiled_vertex_array can help, though it does not necessary does. Also it may calculate shared vertices, though currently it does not ( on modern cards including GeForces ).
Again, if your geometry is static ( geometry, not it transforms ), you can use display lists - potentially driver can save transformed versions of your display lists, though I am mostly sure it does not because of complexity and insane amount of memory required.
The only stuff which can really cache your data is vertex cache ( usually small, about 16 vertices ), but it is too small to store anything except already transformed shared vertices - and can be efficiently used only with triangle strips/fans.

10-04-2000, 08:13 AM
I was mostly interested in the case where you could set either
the view or the projection matrix to identity and remove one
matrix multiply. I see now that that's not doable except in
special cases, and those special cases are not general enough
to be useable.

Thanks.