Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

3D Transformation Problem!

Started by bartiss Nov 2, 2004 at 4:56 AM 2 replies 450+ views
Original Post
bartiss
bartiss
Hi! As you will surely see in the text that follows I'm rookie in DIrect3D (8.1). My "problem" is: Suppose I have 4 objects (tanks for example) and I want them to move independently in a 3D surrounding. So I render hte surrounding transform the fisrt object, render it, transform the second object, render it... etc. (at least that's waht I found in SDK 8.1 tutorials) The question is: Does world transformation move ALL the vertices in the scene just to move ONE object? So if there are 4 objects to move, then whole "world" must be calculated four times? I didn't find a way to transform particluar object without touching the rest of a scene. Is there such way? And what about motion inheritance? I read a book describing DirectX 6 and there are frames and childframes linked with each other. Are they gone with the wind of progress or are they so obvious topic that nobody writes about them anymore? Thanks in advance
atem
atem
the pipeline of a video card consist of several stages. one of the stages does the transformation and pushes the transformed output to the next pipeline stage.
You start pushing vertices into the transformation stage when you call drawprimitiv. The transformation stage can be parametrized with a world transformation matrix. The stage uses this to transform the input vertices. Once the transformed output is generated, the transformation stage neve touches the vertices again. When you call drawprimitive again, you can set a new vertexstream or you can use the same vertexstream. But the input vertices this time will generate a new output while the last output is already pushed to the next pipeline stage. All input vertices are transformed once.
If your triangle object consist of several traingle clusters, you can push them one by one to the transformation stage by calling drawprimitive several times. Each time you can set a new world transformation matrix to transform each triangle cluster seperatly. In motion inheritance, the last world transformation matrix will be concatenated with the new one. This will inherite the last transformation with the new one.
Jacob Roman
Jacob Roman
Yes there is and I found out how on my own. You reset the world matrix for every object you are transforming and drawing using the D3DXMatrixIdentity function. That way there you can control any object independently on what gets rotated/translated. Just be sure to rotate first, then translate. Now if you simply transformed without reseting the matrix for every object, or only have it done once in the beginning of the main loop, then it'll transform everything, which is your problem like you said.

[Edited by - Jacob Roman on November 2, 2004 2:42:57 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.