• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Tispe

SetMatrixArray, Bone Limit and Skinned Model Instancing

4 posts in this topic

Hello again [img]http://public.gamedev.net//public/style_emoticons/default/happy.png[/img]

My game is coming along. I now have a humanoid with 120 Bones. It has 8 Mesh parts, each part is only influenced by maximum 30 Bones of the total skeleton. I do know how to animate this but I am unsure which way I should do it.

My problem is that as of now a vertex may index to bone0 and bone119, or any in between. Which means I have to map out which Bones influence each Mesh Part, copy those bones to a local Matrix Palette for that Mesh Part and THEN I have to convert the bone indices for each vertex to the new local palette.

Instead of doing this Skinned Model Instancing came to mind: [url="http://www.ionixxgames.com/Samples/SkinnedModelInstancing.pdf"]http://www.ionixxgam...lInstancing.pdf[/url]

This paper describes how Textures can hold a large number of bones encoded in them.

My thought is then to code the entire animated skeleton to a texture, pass it to the shader(60 times a second), and use it as an array of many bones (120+).

Is this worth the effort, can it hurt performance? Are there a better ways?


I welcome all comments.
0

Share this post


Link to post
Share on other sites
Using a dynamic texture to store bones is totally fine, as long as the GPU has good support for texturing from the vertex shader. In practice this means DX10-capable GPU's or higher, which means Nvidia 8000-series and up and AMD HD 2000 series and up.
0

Share this post


Link to post
Share on other sites
Would it be reasonable or even possible to try it with DX9?

Here is how I imagine I would split up the Animated Skeleton the "old" way

[CODE]
D3DXMATRIX* pAnimatedBones = new D3DXMATRIX[120];
/*
Combine Transforms and populate pAnimatedBones
*/
struct MeshPart
{
D3DXMATRIX* pLocalBones;
};

//Another place
MeshPart Torso;
Torso.pLocalBones = new D3DXMATRIX[30];

for(int i=0;i<30;i++)
{
Torso.pLocalBones[i] = pAnimatedBones[GetMappedIndex(i,Torso)];
}

//During init vertices will have their bone indices remapped
[/CODE]
0

Share this post


Link to post
Would it be reasonable or even possible to try it with DX9?

Here is how I imagine I would split up the Animated Skeleton the "old" way

[CODE]
#define hTorso 3

D3DXMATRIX* pAnimatedBones = new D3DXMATRIX[120];
/*
Combine Transforms and populate pAnimatedBones
*/
struct MeshPart
{
D3DXMATRIX* pLocalBones;
};

//Another place
MeshPart Torso;
Torso.pLocalBones = new D3DXMATRIX[30];

for(int i=0;i<30;i++)
{
Torso.pLocalBones[i] = pAnimatedBones[GetMappedIndex(i,hTorso)];
}

//During init vertices will have their bone indices remapped
[/CODE]
0

Share this post


Link to post
Share on other sites
[quote name='Tispe' timestamp='1330416435' post='4917324']
Would it be reasonable or even possible to try it with DX9?
[/quote]

Yes, DX9 can do it fine as long as the hardware can handle it.
0

Share this post


Link to post
Share on other sites
Sorry for the bump but I need some pointers. I want to implement this so it runs in DX9.0c/WinXP.

I create a texture using the D3DFMT_A8R8G8B8 flag in managed pool. 120 Bones = 480 pixels. Room for 8 bone hierarchies per row. So animated texture width is 3840 pixels, and height is 4096. This gives me room for 32768 instances on a 3840x4096 texture.

A constant register is updated with the SkeletonID before each DrawEntity.

This pseudo code demonstrates how I copy matrices into the texture:
[CODE]
//Once
D3DXVECTOR4 *pAnimatedMatrices = new D3DXVECTOR4[3840][4096]
//Update matrices

//Each Render Frame
hr = pAnimTex->LockRect(0,&rc,NULL,0);
if(hr==D3D_OK){
CopyMemory(rc.pBits,pAnimatedMatrices,3840*4096*4);
}
pAnimTex->UnlockRect(0);
[/CODE]

Before drawing I set Texture:
[CODE]
SetTexture(D3DVERTEXTEXTURESAMPLER0, pAnimTex);
[/CODE]


HLSL:
[CODE]
const uniform float2 SkeletonID;
sampler2D tex;
float4x4 Bone(tex2D(tex, SkeletonID),tex2D(tex, SkeletonID+float2(4,0)),tex2D(tex, SkeletonID+float2(8,0)),tex2D(tex, SkeletonID+float2(12,0)));
//Transform vertex
[/CODE]


I am treading in deep waters here. Am I going in the right direction? Any shortcomings besides the huge amount of Draw Calls and DX9 instead of DX10 etc..?
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0