To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 14635
14634  |  14636
Subject: 
Re: 3D Transformations Architecture Question
Newsgroups: 
lugnet.cad
Date: 
Fri, 13 Jul 2007 00:31:32 GMT
Viewed: 
2006 times
  
   Basically you keep 1 copy of the object with its vertices in their
original position (local or model space).

   You take the local to world, world to view, view to projection and
projection to viewport matrices and multiply them to get a single
matrix, then you multiply each vertex by that matrix when rasterizing
the triangles.

   Matrix names often change depending on the API that you use (OGL
vs D3D) and sometimes the projection matrix has the viewport in it,
but the idea is pretty much the same.


On Jul 12, 2007, at 11:00 PM, Jeff Boen wrote:

Feedback from the guys who built the viewers (LDGlite, LDView, etc)
would be
really great on this.

I have a project, not Lego, but similar and I'm writing some
software for 3D
viewing and manipulation of items. The LDraw architecture is a good
match so I'm
adapting some of the concepts we use.

I have a question about how you guys attack all the necessary
transformations
needed for viewing. This isn't a "How do you do 3D?" question, I've
got all the
data structures, transformation matrices and drawing routines
implemented. This
is more about how much you process on the fly and how much you
store. Before I
go down the road of implementing my transformation/drawing engine I
want to make
sure I'm not heading down a path that will only waste time.

I have my 3D vertex data, modeled in 3DSMax and imported into
Visual Studio via
some routines I wrote. I store these vertices in objects which also
have
Translation, Scaling and Rotation vectors (each 3D).

Now, each time I need to move, scale or rotate one of these
objects, I could
just apply formulas directly to the vertex data, but that doesn't
seem very
elegant and modifies my raw object data.

I could edit the stored Trans, Scale and Rotation vectors with new
values,
generate a transformation matrix (Trans, Scale, Rot) based on these
values, then
apply that to vertices, but again, I'm modifying my original object
directly.

I could apply said transformation matrix to a clone of the vertex
data which
would be created, drawn, then destroyed once drawing was complete,
but this
means I'm going through lots of math for every change of an object.
And if I'm
redrawing every object on the screen due to a change in one that
means lots of
transformation math to obtain data that didn't actually need updating.

I could at least store each object's transformation matrix and only
recalc it
when the object's Trans, Scale, or Rot values change, but this
still means I
have to do all the actual transformation math applied to each
vertex for every
change. I believe that this stored transformation matrix is how
much of the
LDraw software functions, thus making up the 9 of the 12 numbers we
all know and
love on every line of a .DAT/.LDR file. But I might be wrong.

Or, I could store 2 sets of vertex data. The raw, original object
data, and the
transformed vertices, which I would only update when the Trans,
Scale, or Rot
values change. This would maintain my original vertex data and also
allow me to
have quick access to current draw data, but at the expense of
essentially
doubling the amount of vertex data I keep in memory.

So the ultimate question is, for the guys who wrote LDraw viewers/
editors, do
you do all the transformation math for every object all the time,
or do you
store much of the data and only update it when necessary?

I know I can do this all in OpenGL or D3D and probably not have to
worry about
most of it, but I want to do it myself for real first to completely
understand
it, then I'll port it.

Any advice? Or am I completely off-base with all this analysis?

TIA
Jeff
onyx(at)brickgun.com



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________



Message is in Reply To:
  3D Transformations Architecture Question
 
Feedback from the guys who built the viewers (LDGlite, LDView, etc) would be really great on this. I have a project, not Lego, but similar and I'm writing some software for 3D viewing and manipulation of items. The LDraw architecture is a good match (...) (17 years ago, 12-Jul-07, to lugnet.cad)

8 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR