help! d3d8 mini and silly questions like, world matrix etc.,..

Started by
4 comments, last by mickey 21 years, 10 months ago
hiya, am not really that far in d3d yet, but am just curious about these things so hope you could help me out, advance thanks, ehm, if you set a transformation, ie, world trans, it affects ALL objects in the scene right? so what if i want this model to rotate, and this one to be in another position? so that''ll be two world trans? but this is expensive right? having a lot of world trans? also, do i set this world trans(position) on the initialization process or every game frame? is there any other way, to animate your model, aside from locking and using world trans(for untransformed vertices)? how do you guys give values to your object''s vertices? do you even care? because, you could easily alternate their actually pixel coords/size via the camera matrix right? like forexmaple you have this 5000.0f x and y size of a square, well, totally zoom out so that square would look small, i mean, what''s with these values? can i use for all my camera needs the D3DXMatrixLookAtLH() function? or what does it ''cannot'' do? many thanks!!!
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
Advertisement
The matrices you have set only affect whatever you draw using those matrices.

So for objects in different positions you''d set the world matrix to the appropriate values before each object.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
quote:Original post by mickey
if you set a transformation, ie, world trans, it affects ALL objects in the scene right?

More precisely, it affects all object in the scene that are rendered while this transform is active.
quote:
so what if i want this model to rotate, and this one to be in another position? so that''ll be two world trans? but this is expensive right?

Not nearly as expensive as locking the vertex buffer and modifying the position that way.
quote:
having a lot of world trans?

Yes, this is usually what you end up with. SetTransform, DrawPrimitive, repeat as necessary. There are also matrix stacks to help you with nested transforms (ID3DXMatrixStack, IIRC)
quote:
also, do i set this world trans(position) on the initialization process or every game frame?

You set the appropriate world transform before you render the objects that need that transform.
quote:
is there any other way, to animate your model, aside from locking and using world trans(for untransformed vertices)?

Maybe, but I can''t name any.
quote:
how do you guys give values to your object''s vertices?

If the object is pre-made, like an .x file, then I just use whatever coords they have. Otherwise, I pick some "reasonable" values. If I''m generating geometry dynamically, I usually have parameters that define how big the model is, which allows me to easily create objects of different size.
quote:
do you even care? because, you could easily alternate their actually pixel coords/size via the camera matrix right? like forexmaple you have this 5000.0f x and y size of a square, well, totally zoom out so that square would look small, i mean, what''s with these values?

This is absolutely correct. You can have as big or as small objects as you like. I usually try to keep my things at aroung 1-100 units.
quote:
can i use for all my camera needs the D3DXMatrixLookAtLH() function? or what does it ''cannot'' do?

I suppose it''s only useful if you have 3D projection transform (ie, non-ortho). I never used anything else to navigate in my worlds.
---visit #directxdev on afternet <- not just for directx, despite the name
ei IndirectX it's you again to the rescue! thanks again for clearing things for me,

i got another question, is it possible, to specify the vertices of my 3d object and create a vertex buffer for this, then i'll just apply the texture mapping later on? Aside from scratching the older vertex buffer and creating a new one, is there any other way for this? or, could i apply a texture on a set of vertices/faces without putting texture coordinates on a face/vertices?

and last, ehm., after i finished drawing everything and upon calling EndScene(), is everything flush? i mean, for example my last call involves changing a position and setting a texture, upon the name game loop or begin scene, would this be in effect? coz am having weird problem, i've got 2 object, one in which i applied texture and the other one just plain cube(no texture), well, my cube received weird texture mapping that flashes on all of it's faces from time to time, ?

siaspete, thanks too!



[edited by - mickey on June 2, 2002 12:16:48 PM]
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
quote:Original post by mickey
is it possible, to specify the vertices of my 3d object and create a vertex buffer for this, then i''ll just apply the texture mapping later on? Aside from scratching the older vertex buffer and creating a new one, is there any other way for this? or, could i apply a texture on a set of vertices/faces without putting texture coordinates on a face/vertices?

There are two kinds of texture coordinates: predefined and generated at runtime. For predefined coordinates, your FVF must have at least one tex coord set. If you created a VB without tex coords, you can''t add them later into this VB. However, you can create VB with space for tex coords but draw it with texturing disabled while you don''t know the tex coords, and then fill the coords in and draw the same VB with texturing enabled.

Texture coordinates can be generated by D3D at runtime. The tutorials show how to do so, although I didn''t yet understand their code. Look for "texture coordinate generation". For dynamically generated texture coords, you don''t need tex coords flags in your FVF. For example, if you have a textured model to which you apply an environmental map, you only need one set of tex coords for the model texture, and D3D will generate envmap tex coords by itself.
quote:
and last, ehm., after i finished drawing everything and upon calling EndScene(), is everything flush?

Flush usually happens when you call Present, not EndScene.
---visit #directxdev on afternet <- not just for directx, despite the name
aye! thanks!!!

http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,

This topic is closed to new replies.

Advertisement