Confused about transformation pipeline...

Hi, I'm writing a simple 3D engine. It's my first attempt at this so I apologize in advance if I seem new at this. ( I am. )

I'm having trouble understanding the order of things when transforming the vertex buffers. I read some articles about frames (frame of reference), but I'm not able to grasp how a single frame (screen buffer) is rendered in terms of the order that each frames (frame of reference) is transformed.

Say I have a simple planetary system involving a sun and another planet orbiting around it. Both the sun and the planet rotates on it's own axis with the planet also moving around the sun in a circular motion. In code, since we call transform on the d3d device, how are each of the sun and the planet transformed I understand that the sun and the planet's frame should be a child of the whole system's frame, and each frame will keep up it's own transformation, but how is this implemented in code, especially the order in which the transform method is called on each frame I think some sort of picture or schematics will reall help me visualize what exactly is going on.

Am I correct in thinking that you render each frame by putting that frame as the center of the world cord. and the move on the each child to do the same thing So you are actually drawing each frame one by one Or is it done all at once

Thanks in advance for answering this newbie question.


Answer this question

Confused about transformation pipeline...

  • RahulAhd

    Actually I think the answer to this one is even more simple. I thin you are talking about the hierarchy of objects in your engine and rendering those objects (mesh hierarchies is more usually used for animating within a mesh such as movign arms and legs on a character).

    You need to search for discussions about scen graphs and hierarchical transformations. If you are using managed code I suggest my tutorial on Coding4Fun.

    http://msdn.microsoft.com/coding4fun/holiday/DirectXmas2/default.aspx



  • vivek_pon

    Thanks for all the replies thus far. I'm beginning to understand this a lot more than before. I took a look at both of the resources suggested and I now have another question after reading the managed code page by ZMan.

    I'm using unmanaged code right now, but it seems to me with your example that you kept the different parts of the tree in separate meshes. In unmanaged terms, is that equivalent to using separate vertex buffers if I was not going to make meshes out of the vertex data Is that something desireable to do I read that directx performs better if you can pool as much vertex as possible in one call, or is it better if I make meshes out of the vertex datas

    Specifically, in my program, I would like to eventually incorporate mechanisms that will read in a script to generate the vertex datas, and ultimately create the geometry and map the textures. How are these resources managed in most situations

  • Hila123

    If you go to this link, you will find a paper and source code that explains

    what you are talking about. Mesh Hierarchies and Animation is the title.

    You can right click on title and save pdf to local drive.

    http://www.moon-labs.com/ml_resources.htm



  • JayJay

    Don't take that part of the tutorial as something that is a good thing to. I was trying to illustrate hierarchical transformations and scene representations but in reality you would not have that many individual meshes. e.g. each tree is 4 cylinders and 24 decorations so there are 24 draw calls per tree. This is exactly what you should not do and if you crank the screen saver up to a high tree density you will see why. Performance sucks.

    In reality for that code you would have an artist make you a tree mesh which was a single mesh and use the kind of mesh animation techniques described in laforced's post to change things within it (changing colors or moving legs is changing things inside a mesh). Since that whole scene is static you could go one step further and create a single large vertex buffer with all the trees inside that and render the whole lot in one go - more memory requirements but a singe draw call. On modern hardware you can use hardware instancing where you sent the graphics card details on the shape and details of all the instances in 2 separate buffers and the card handles everything. Of course none of this stuff is managed/native specific.

    So just as in any programming there are many ways to solve the same problem each with their pros and cons.

    For the most part models and textures are created by artists in high end modelling tools then either exported through the .x format or through some custom format defined by the programming team. Then you need something that will export that from the particular modeller you are using.



  • Confused about transformation pipeline...