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 / 14634
14633  |  14635
Subject: 
3D Transformations Architecture Question
Newsgroups: 
lugnet.cad
Date: 
Thu, 12 Jul 2007 23:00:59 GMT
Viewed: 
2083 times
  
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



Message has 2 Replies:
  Re: 3D Transformations Architecture Question
 
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 (...) (17 years ago, 13-Jul-07, to lugnet.cad)
  Re: 3D Transformations Architecture Question
 
(...) Actually, based on what you write after the above, this is a "How do you draw in 3D?" question, which is fairly close to "How do you do 3D?". The implementation details of how 3D gets drawn to the screen tend to answer all your questions. When (...) (17 years ago, 13-Jul-07, to lugnet.cad, FTX)

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