Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 6026 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is probably very simple stuff... I have an vertex buffer and a transformation matrix. Instead of setting the worldmatrix and rendering the object, can I fill up another buffer with all the vertices in worldspace in? Would this be a buffer of transformed vertices? I want them in worldspace so that I can compare their location with other vertices around it. Yup, for collision testing. The problem is, I got vertices in object space and a transformation matrix set up, and i need a buffer of vertices in worldspace... It doesn't seem that hard, but I seem to be missing something. *argh* Edited by - JohanK on March 23, 2002 5:59:01 PM

Share this post

Link to post
Share on other sites
Hi there,

I often combine large sets of small items into one large vertex buffer for more efficient rendering (one call to draw primitive instead of 1000 for example). This is similar to what I''m doing.

You have two options:
1) Transform only the positional (xyz) data into an array of world space D3DVECTORs. This array should be in system memory (as opposed to a nonlocal or video memory VB) for easy access. This data will only be used for collision testing, and not for rendering. The original data will be used for rendering.

2) Transform the whole vertex into a new buffer. These are still considered untransformed, as they have not yet been lit or passed through the camera or perspective transformations. You will still want a system memory array (or buffer, array is easier) to provide your collision routines easy and fast access.

For either method, you can use D3DXVec3TransformCoord to transform by your matrix.

For method 2, you will want to also transform your normals for proper lighting, but that is a little tricky as you don''t want to translate or scale them.

For method 2, you can take your result and concatenate several "models" (or whatever the data represents) together in the same buffer for one (or very few) drawprimitive call(s), if they all share the same texture, etc (think, a bunch of trees for example). If they are mostly different, method 1 is probably better, and just render the original data with world transformation. Its all up to you, though :-)

You don''t want your source data to be in a non system memory buffer, as reading from video or non-local memory is very very slow. In short, if you''re going to manipulate it, keep it in system memory. If you''re just going to send it to the hardware, put it in video memory.


Share this post

Link to post
Share on other sites
That works perfecly, thanks man!

So much to learn and so little time... Using method 1 since I only need the raw xyz info.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!