Jump to content

  • Log In with Google      Sign In   
  • Create Account


DirectX 11: Draw instanced and rotation question


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Magogan   Members   -  Reputation: 153

Like
0Likes
Like

Posted 09 July 2014 - 03:22 AM

Hi,

I want to draw the same model on different locations in the world. I know I can do this with the DrawIndexedInstanced function, but if I want to rotate one or some of these objects by 45°, 80°, 251° etc., how can I do it? Do I have to create multiple Instance buffers and rotate the model to the specified angle and draw the instance buffer 1, then rotate again and draw instance buffer 2 etc.? Or is there a simplier way? Programming language is C++.

Greetings,
Magogan

PS: Sorry for my bad english, if it was really as bad as I think it was :D

Sponsor:

#2 Buckeye   Crossbones+   -  Reputation: 4465

Like
1Likes
Like

Posted 09 July 2014 - 07:53 AM

You can do it several ways. You can stream in the angle with the location, or load an array of angles (and locations, for that matter) in a constant buffer, accessing the angle with the instance ID.


Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.


#3 kauna   Crossbones+   -  Reputation: 2345

Like
2Likes
Like

Posted 09 July 2014 - 11:53 AM

Or store a full transform matrix for each mesh in a constant buffer or generic buffer object and index it with the InstanceID. The transform matrix is maybe simpler than just working with positions and rotations. 

 

Cheers!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS