Imagination PowerVR SDK Blog

Animation Problems

pvrgeopod
pvrshaman

#1

Hey Everybody,
Is anyone else having problems getting there POD files to work with models that have vertex’s that are hand animated not driven by bones?

For instants I’m using 3d Max 9 and I have a character that is a Cube with eyes as a single model and so I have the Cube scaling for squash and stretch animation and then I went into the vertex mode and animated the eyes vertex’s. The Cube POD animation works fine but the eye animations don’t work at all.

Can anyone explain to me why it doesn’t work?

And also if I can’t animate vertex’s what is the best way to export a model using bones cause it seems like I can’t get bones to work as well?

Thanks Big%20smile,

Jamie


#2

Hi Jamie,


<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 


I’m afraid the reason the eye’s animation isn’t working is that the POD format doesn’t support animated vertices.


 


What problems are you seeing getting bones to work? We have a few apps in our SDK that use bones and they’ve been attached using max’s Skin modifier and when exporting they have the “Export skin modifiers” option enabled in PVRGeoPOD.










Thanks


Scott


#3

Hey Scott thanks for replying and thanks for letting me know that I can't animate vertices, I animated it that way cause it would of been easier doing it that way instead of using bones.

As for bones I just did a simple test and well it didn't work. I created a box and then I put three animated Max bones inside of it and then I put a skin modifier (not skin wrap modifier) and exported a POD files with all the right settings including "Export skin modifiers." I open up the POD in the latest Shaman and the bones are moving around but not the box itself meaning the skin didn't carry over. IDK!?!

Oh one other question I have, does the POD file support the morph modifier in Max?

Thanks,
Jamie

jlg19802008-10-10 19:46:10

#4

PVRShaman currently only supports skinning through the use of pfx effect files which may explain why it looks like skinning isn't working. To assign an effect file to your skinned object open up its material properties and set it to use an effect file. Below is a very basic example of a pfx file that performs skinning.


 

Code:
[HEADER] 
 VERSION  01.00.00.00
 DESCRIPTION Skinning
 COPYRIGHT ImgTec
[/HEADER] 
 
[TEXTURES]
[/TEXTURES] 
 
[VERTEXSHADER] 
        NAME myVertShader 
        [GLSL_CODE] 
               attribute highp vec3 myVertex;
               attribute highp vec3 myNormal;
               attribute highp vec2 boneIdx;
               attribute highp vec2 boneWeight;
               uniform mediump int  boneCount;
               uniform mediump mat4 boneMatrixArray[8];
               uniform mediump mat4 ViewProj;
               void main(void)
               {
                       vec4 position = vec4(0);
                       vec3 normal = vec3(0);
  
                       if(boneCount>0)
                       {
                                  vec4 index  = vec4(boneIdx, 0, 0);
                                  vec4 weight = vec4(boneWeight, 0, 0);
   
                               for (int i = 0; i < 4; i++)
                               {
                                       if(i < boneCount)
                                       {
                                               mat4 m44 = boneMatrixArray[int(index.x)];
                                               position += m44 * vec4(myVertex, 1.0) * weight.x;
     
                                               mat3 m33 = mat3(m44[0].xyz, m44[1].xyz, m44[2].xyz);
                                               normal += m33 * myNormal * weight.x;
     
                                               index = index.yzwx;
                                               weight = weight.yzwx;
                                          }
                                   }
   
                     gl_Position = ViewProj * position;
              }
       } 
       [/GLSL_CODE] 
[/VERTEXSHADER] 
 
[FRAGMENTSHADER] 
       NAME myFragShader 
       [GLSL_CODE] 
       void main (void)
       {
              gl_FragColor = vec4(1.0,0.0,1.0, 1.0);
       }
       [/GLSL_CODE] 
[/FRAGMENTSHADER] 
  
[EFFECT]  
       NAME  myEffect 
  
       ATTRIBUTE myVertex   POSITION 
       ATTRIBUTE myNormal   NORMAL
       ATTRIBUTE boneIdx    BONEINDEX
       ATTRIBUTE boneWeight   BONEWEIGHT
 
       UNIFORM  ViewProj   VIEWPROJECTION
       UNIFORM  boneCount   BONECOUNT
       UNIFORM  boneMatrixArray  BONEMATRIXARRAY
 
       FRAGMENTSHADER  myFragShader 
       VERTEXSHADER myVertShader 
[/EFFECT] 
 


 

Jamie wrote:

Oh one other question I have, does the POD file support the morph modifier in Max?

<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 


I'm not particularly familiar with the morph modifier but I would say it isn’t supported as it is modifying the vertices. If you would like to morph between different meshes you could do something similar to the OGLES Evil Skull demo in that you export the different meshes and morph between them in the code.