Jump to content
  • Advertisement
Sign in to follow this  

World Space Translation

This topic is 3047 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

I have all my pointers for the DX10 Structures i need to create, draw, and remove a D3DX10Mesh for each element of the ModelObject structure type i've defined. During creation of the mesh all the vertex and index counts / arrays are defined in another custom structure where i keep all the base model information at hand.

Now what i wanted to do was create multiple meshes using the same base model information but just different translations into world space so their origin points are different.

Here is my code for the draw function.

What i thought i could just do was take the World Matrix and multiply it by a translation matrix of x, y, z to create a new matrix and then use that as the World Matrix in my finalMatrix calculation.

Does that sound right?

void DrawTerrain(ModelObject *modelobject)
// Set the input layout

// Set the texture resource view

D3DXMATRIX finalMatrix = (WorldMatrix * ViewMatrix * ProjectionMatrix);

// Render a model object
D3D10_TECHNIQUE_DESC techniqueDescription;

// Loop through the technique passes
for(UINT p=0; p < techniqueDescription.Passes; ++p)


Share this post

Link to post
Share on other sites
The process of drawing many objects from a unique object definition is referred to as Geometry Batching. Modern GPUs implement this technique using Instanced Geometry.

Let's say you want to draw 50 squares. First, you will define a vertex buffer and an index buffer to represent a single square. Then, you will create a second vertex buffer containing information on how each square should be drawn in your scene. In the simplest case, the second buffer will contain a unique world transformation matrix per square. This allows you to draw all your squares with a single call to 'draw'.

Here is a link to the DirectX SDK sample to illustrate how to implement this technique. In addition, it contains all the gory details on how to manipulate the API and how to author shaders for instancing.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!