AI 에이전트 · 에이전트 스킬 · 엔지니어링 아카이브

오픈소스 AI 에이전트·에이전트 스킬 분석과 개발자 도구·시스템 엔지니어링 실전 기록

우선 마야에서 skinning이 적용된 캐릭터를 애니메이션하는 방법을 보자.

(DIGITAL TUTORS THE NEEX PROJECT 참조)


1. custom shelf에 다음 툴들을 추가

Edit Polygons > Split Polygon Tool

Edit Polygons > Cut Faces Tool

Edit Polygons > Extrude Faces

Skeleton > Joint tool

Skeleton > IK Handle Tool (option)

Display > Component Disply > Local Rotation Axis


2. 모델 만들기

Polygon Primitives > Cube를 만든다

Polygons > Smooth Proxy (option) 를 한다

Subdivision Levels를 2로 하고 Smooth 한다.

Split Polygon과 Extrude Faces를 해서 몸형태를 전부 만든다.


3. 뼈대 만들기

IK Handle Tool에서 ikRPsolver (IK Rotate Plane Solver) 선택되어 있도록 만듬.

Display > Joint Size 로 조인트 크기 조절

Skeleton > Joint Tool (option) 에서 Auto Joint orient 를 none으로 한다.

조인트를 그려준다.

조인트의 이름을 수정한다.


※ 어려운 부분

Local Rotation Axis 툴 선택하고 조인트를 선택해서 Local Axis 돌려주는 부분 이해하기 힘들 것임.

그러나 그냥 넘어가자.


4. 발 움직일 때 발 끝을 잡고 움직이면 좋다.

Skeleton > IK Handle Tool (option) 선택해서 ikRPsolver (IK Rotate Plane Solver) 선택한다.

IK Handle Tool 선택하고 골반의 시작점과 발의 끝점을 선택한다.

그러면 IK Handle 이 만들어진다.

IK Handle의 끝이 되는 관절을 선택한다. 그것을 움직이면 IK Handle이 움직인다.


※ 어려운 부분

발에다가 하나를 더 만들어서 움직이는 방식 이해하기 힘들 것임. 그러나 그냥 넘어가자.


5. Bone과 Skin을 bind하기

Animation Menu > Skin > Bind Skin > Rigid Bind / Smooth Bind

(.x file로 익스포트하려면 Smooth Bind를 써야 한다.)


이렇게 하면 뼈랑 피부가 붙지만 부분적으로 bad folding이 생긴다.

동영상에서는 이를 Joint Lattices 를 추가해서 해결한다.


6. 키프레임을 만드는 방법

움직인 오브젝트를 선택해서 s 키를 누른다. 그러면 키프레임이 생긴다.


위 방법으로 마야에서 폴리곤 원통이 구부러지는 간단 애니메이션을 만들어서

그것을 .x 파일로 익스포트해보자.


** 주의사항 :

Rigid Bind를 하면 XSkinMeshHeader{} 및 SkinWeights{}가 안생긴다.

이는 SimpleAnimation 뿐 아니라 DirectX Viewer에서도 보이지 않는다.

Smooth Bind하면 x file을 더블클릭했을 때 DirectX Viewer에서 보임.


** 익스포트된 .x 파일의 수정

익스포트된 .x 파일은 그냥 하면 당연히 SimpleAnimation에서 안읽힌다.

원래 tiny.x에는 없는데 익스포트 하면 나오는 것에는

DeclData{}, MeshVertexColors{}, AnimTicksPerSecond {} 블럭 등이 있다.


DeclData{} 블록은 지워야 한다. 이것이 남아 있으면 SimpleAnimation에서 읽지를 못한다.

MeshVertexColors{} 블록도 지워야 한다. 이것이 남아 있으면 텍스처가 보이지 않는다.


AnimTicksPerSecond {} 블럭은 있어도 되고 없어도 되지만 없는 것이 효율적일 것이다.

AnimTicksPerSecond {} 을 안쓰려면 마야에서 애니메이션을 프레임 단위로 해야 한다.

(1 tick = 1 frame)


즉 .x 파일은 다음과 같은 구조가 되도록 만든다.



(예1) tiny.x의 구조


xof      0303txt      0032

template      XSkinMeshHeader      {...}

template      VertexDuplicationIndices      {...}

template      SkinWeights      {...}


Frame      Scene_Root      {

      FrameTransformMatrix      {}

      Frame      body      {

            FrameTransformMatrix      {}

            Frame      {

                  FrameTransformMatrix      {}

                  Mesh      {

                        ...

                        MeshNormals      {}

                        MeshTextureCoords      {}

                        VertexDuplicationIndices      {}

                        MeshMaterialList      {

                              ...

                              Material      {

                                    ...

                                    TextureFilename      {"Tiny_skin.dds";}

                              }

                        }

                        XSkinMeshHeader      {...}

                        SkinWeights      {      "Bip01_R_UpperArm"; ...}

                        SkinWeights      {      "Bip01_Spine3";      ...      }

                        ...

                  }

            }

      }

      Frame      Box01      {

            FrameTransformMatrix      {...}

            Frame      Bip01      {

                  FrameTransformMatrix      {...}

                  Frame      Bip01_Footsteps      {

                        FrameTransformMatrix      {...}

                  }

                  Frame      Bip01_Pelvis      {

                        FrameTransformMatrix      {...}

                        ...

                  }

            }

      }

}

AnimationSet      {

      Animation      {

            AnimationKey      {...}

            {      Scene_Root      }

      }

      Animation      {

            AnimationKey      {...}

            {      body      }

      }

      ...

}



(예2) MySkinningTest.x의 구조


xof      0303txt      0032

template      XSkinMeshHeader      {...}

template      VertexDuplicationIndices      {...}

template      SkinWeights      {...}

AnimTicksPerSecond      {...}

Frame      SceneRoot      {

      FrameTransformMatrix      {...}

      Frame      pCylinder2      {

            FrameTransformMatrix      {...}

            Frame      pCylinderShape2      {

                  FrameTransformMatrix      {...}

                  Mesh      pCylinderShape2_Mesh      {

                        ...

                        MeshNormals      {...}

                        MeshTextureCoords      {...}

                        VertexDuplicationIndices      {...}

                        MeshMaterialList      {

                              ...

                              Material      {

                                    ...

                                    TextureFilename      {"Tiny_skin.dds";}

                              }

                        }                       

                        XSkinMeshHeader      {...}

                        SkinWeights      {...}

                        SkinWeights      {...}

                        ...

                  }

            }

      }

      Frame      joint12      {

            FrameTransformMatrix      {...}

            Frame      joint10      {

                  FrameTransformMatrix      {...}

                  Frame      joint11      {

                        FrameTransformMatrix      {...}

                  }

            }

      }

}

AnimationSet      Default      {

      Animation      {

            AnimationKey      {...}

            AnimationKey      {...}

            AnimationKey      {...}

            {      joint10      }

      }

}


반응형

'GamePrograming' 카테고리의 다른 글

마야에서 맥스로  (1) 2007.04.30
스킨드 메쉬 직접 구현(엑스파일 파싱)  (0) 2007.04.19
Xfiles  (0) 2007.04.19