3D Graphic Demo: Hello RobotArm

Robotic Arm Demo

Description:

This project demonstrate 2 different bone skeleton system and animating them.
Both skeleton system can:
  • [Custom Bone Structure]:  Build a bone structure with maximal 50 bones 
  • [Support Animation]:         Support key frames editing to create animation
  • [Support Save & Load]:     Can save & load all information of current system

Implementation:

    • Create a window with win32.
    • Using Direct3D11 to create a render target. Render the target with general graphic pipeline. And render to the window.
    • Draw Debug Ui to sub render target with DearImgui(https://github.com/ocornut/imgui).

Demonstration:


Tutorial for my classmates:

  • This tour guide you to a simplify version of Robot arm
  • Create Robot Arm
    • Flow:
      • Set up environment: 
        • Thinking: In order to render a robot arm which has multiple parts, firstly we need to have a scene with light, and mesh that can reflect light (which is standard mesh in our engine) for each robot arm part.
        • TODO:
          • Create <scene> class that has a <light> & <lightBuffer>
          • Create <RobotArmMesh> which has:
            • <StandardMesh> 
            • <Material>
            • <MeshBuffer>
            • <ConstantBuffer of transform info for vertex shader>
            • <VertexShader>
            • <PixelShader>
            • <Vec3 pos> <Quat rot> <Vec3 scal> for correction matrix
            • Add Load(), which load all the above datas
            • Add Render(), which load above datas in to Video card and render the mesh
            • Add UnLoad() unload the above data
      • Create A Robot Arm Class:
        • Thinking: A Regular Robot arm are made of some parts that connects each other head to end. So we can have multiple meshes in our Robot Arm. Each mesh Render with its own transform matrix. And we Update transform matrix with current bone to rotate them.
    How ever, if all the robot arm segments are the same, we could just use 1 mesh.
    In the bone struct, think the toParentTransform as the transform between local to parent. So rotate this toParentTransform can allow us control rotation on a single segment. Furthermore, We need our <RobotArmMesh> to have a special render function that can take a Matrix4 that is current bone’s toParentTransform. So that our mesh can draw different transform base on different bone
      • TODO:
        • Add a special render function to <RobotArmMesh> so that its take an extra matrix.
        • Create a <RobotArm> class which has
          • A <RobotArmMesh>
          • vector<Bone> bones
          • Load() that load the mesh, and add Bone in to vector(hint: reserve the vector first)
          • Render() that loop through bones, user robotArmMesh to draw with different bone’s toParentTransform.
          • UnLoad() unload the mesh.
    • Add Some Arm Segment And Test:
      • Thinking: The toParentTransform of a bone decide how you connect it to its parent. In addition, if we add multiply rotation matrix on toParentTransform, we will rotate the segment.
      • TODO:
        • Add a <AddSeg> function
        • Add a <Control> function
    • Not Correct! We need to stack the toParentsTransform of each parent’s bone:
      • Thinking:
    For current situation, it seems like everyone treat origin as their parents.
    So we need a way to stack the toParentTransform of all the parent’s of a single child bone. 
    Of course, their multiple ways of doing this. We can use a recursion call to calculate everyone’s final toParentsTransform before drawing. Or we can draw from root, calculate toParentsTransform while we are drawing.
    This tour, we are using peter chan’s style. Which he gives us a function in class a hint:It’s update a bone’s final toParentTransform, and store it to a vector. And recursively update all its child bone.It looks like we don’t need to call this function every frame, we can simply call it when we update certain bone’s toParentTransform(when we rotate it). And also the situation of add new bone.
    The vector<mat4> boneMatrix stores the final transform we stack together, we grab it and draw no extra calculation needed.
      • TODO:
        • Add childSpwanPos in to your mesh, and set it up in Load Function
        • Add an Internal function <UpdateTransfrom>into <RobotArm.cpp>
        • Add vector<Mat4> boneMatrixs.
        • Call <UpdateTransfrom> in <control> and <addSeg>
    • Finished!


The demo is made in NFGE, which is my own game engine written in C++.

Comments

  1. I found decent information in your article. I am impressed with how nicely you described this subject, It is a gainful article for us. Thanks for share it.couples hunting trips.

    ReplyDelete
  2. I read your blog now share great information here. robotic arm kits

    ReplyDelete

Post a Comment

Popular posts from this blog

NFGE

Physics Demo: Grass Simulation

3D Graphic Demo: YBot-Simulation(In Progress)