Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Problems in rbody file

Help
moetman
2005-03-09
2013-04-17
  • moetman
    moetman
    2005-03-09

    Hi, I'm having trouble loading my meshes . If I set any of the three to be default I crash - If I set all to 0 the app runs but no model .. what should I look for when coming upon this problem ?

    Regards

     
    • Peter S
      Peter S
      2005-03-11

      Can't see why it should crash if your just trying to use one mesh, have you compared your rbody-file to the one that follows with the demo?

      There should be no problem using several meshes for a replicantbody character. Just add the meshes using the "Mesh" struct in the .rbody file. You also have to make sure that your material set ("MaterialSet" struct) is mapping the material "thread ids" in your mesh to the exported cal3d materials. So, if your mesh in cal3d has a material named "upperbody [1]", its "thread id" is 1, that is, the number between the brackets. Note that this name isn't the filename of the material but the name of the material in 3DStudio. Later you load your materials using the "Material" struct in the .rbody file, referring to the exported materials' filenames. The materials get their "material ids" in the order they are defined in the .rbody file (starting at 0). So, if your mesh is tied to a material named "upperbody [1]" in 3DS and that material is defined first (read: loaded first) in the .rbody file, your material set struct should look something like this:

      MaterialSet {
          name Causal clothing
          is_default 1
          Connection {
              thread_id 1 // number between brackets, unique
              material_id 0 // order defined in file, unique
          }
         
          ...
         
          Connection {
              ...
          }
      }

      You have to add a connection for all your exported and earlier defined materials that's used in your meshes. You can also define several material sets, making it easy to switch clothing.

      regards
      Peter Sunna

       
    • moetman
      moetman
      2005-03-12

      Thanks Peter , I managed to get one mesh into my application but it is only 1 of 3 (a Horse). but no animaiton and the materials are not where they should be . I've managed to get a working model running under osgCal so I'm fairly confident my model works , I'm just unsure of the syntax of the .rbody file. Maybe someone could see if it looks right..
      My model is a horse and rider , using charactar studio for the rider and the sword and horse are linked off the center of mass (root) with 3dmax bones.

      Thanks  again

      # ReplicantBody v0.1

          path "./"
          skeleton "HorseRiderSkel.CSF"
          default_act "ACT_CANTER"
          scale 0.025
          foot_offset 3.0 // Before scaling

          // Bones used when calculating character speed
          ContactBones {
              bone_name "Bone_OF_05"
              bone_name "Bone_NF_05"
              bone_name "Bone_R_OH_06"
              bone_name "Bone_R_NH_06"

          }

          // Bones from which you can get the direction
          DirectionBones {

              head_bone "SPINE_BONES04"

          }

          Animation {
              name "canter"
              filename "../Cuirassier_animations/Canter.caf"
              act_name "ACT_CANTER"
              act_weight 1.0
              speed 4
              is_looped 1
          }

          Mesh {
              name "Object01"
              filename "Cu.cmf"
              is_default 0
          }

          Mesh {
              name "Horse"
              filename "Ho.cmf"
              is_default 1
          }
          Mesh {
              name "sword"
              filename "sword.cmf"
              is_default 0
          }
          Material {
              filename "face [0].CRF"
             
          }
          Material {
              filename "Metal [1].CRF"
          }
          Material {
              filename "CurassierHelmet[2].CRF"
          }
          Material {
              filename "RedMaterial [3].CRF"
          }
          Material {
              filename "CurassierHelmetCircle[4].CRF"
          }
          Material {
              filename "blueFur [5].CRF"
          }
          Material {
              filename "HorseMane [6].CRF"
          }
          Material {
              filename "CurassierStrap [7].CRF"
          }
          Material {
              filename "BlackTexture [8].CRF"
          }
          Material {
              filename "whiteLeather [9].CRF"
          }
          Material {
              filename "Leather [10].CRF"
          }
          Material {
              filename "Gold [11].CRF"
          }
          Material {
              filename "Horse[12].CRF"
          }
          Material {
              filename "sword[13].CRF"
          }
          Material {
              filename "pelham[14].CRF"
          }
          Material {
              filename "saddleblanket[15].CRF"
          }
          Material {
              filename "saddleblag[16].CRF"
          }   

          MaterialSet {
              name "original"
              is_default 1
         
          Connection {
                  thread_id 1
                  material_id 0
              }
          Connection {
                  thread_id 2
                  material_id 1
              }
          Connection {
                  thread_id 3
                  material_id 2
              }
          Connection {
                  thread_id 4
                  material_id 3
              }
          Connection {
                  thread_id 5
                  material_id 4
              }
          Connection {
                  thread_id 6
                  material_id 5
              }
          Connection {
                  thread_id 7
                  material_id 6
              }
          Connection {
                  thread_id 8
                  material_id 7
              }
          Connection {
                  thread_id 9
                  material_id 8
              }                                           
          Connection {
                  thread_id 10
                  material_id 9
              }
          Connection {
                  thread_id 11
                  material_id 10
              }
          Connection {
                  thread_id 12
                  material_id 11
              }
          Connection {
                  thread_id 13
                  material_id 12
              }
          Connection {
                  thread_id 14
                  material_id 13
              }
          Connection {
                  thread_id 15
                  material_id 14
              }   
          Connection {
                  thread_id 16
                  material_id 15
              }                           
          }

       
    • Peter S
      Peter S
      2005-03-12

      I cannot see any errors in your .rbody-file. However, if you want to see all three meshes at startup you should set them all to default. Are you using the rbodydemo (but with your data files) to test your models? If not, look at main.cpp and and KeyboardEventHandler.[h|cpp] in demos/ to see how to setup the character. If your character doesn't animate, make sure you get it's DEFAULT_ACT and execute it. See main.cpp, code below comment

      // Does it have a default action? (Specified for the CORE BODY in RBODY_FILE)"

      I strongly recommend to first get your models work with the demo. Another way around is to get bizguy (the character following with rbodydemo) to work in your app.

      Another important thing regarding the materials are that it is the 3DS name from which they get their thread_id. That is, make sure that the materials tied to your character in 3DS have names with [thread_id]. What their exported filenames are aren't important. It is, however, a good idea to name them as you have done to keep track of their thread_ids when constructing the material set.

      In some cases the v-coord must be inverted for the material textures to be displayed correctly. This is done by calling CalLoader:

      CalLoader::setLoadingMode(LOADER_INVERT_V_COORD)

      In the rbodydemo this can be done, for example, right before the main-loop.

      regards
      Peter Sunna

       
    • moetman
      moetman
      2005-03-13

      Thanks a lot Peter , I appreciate your help greatly.

      I'll see if I have made the apppropriate calls , I have got bizguy running in my application but I haven't tried running my model in the rbody example - I'll give her a try..

      once again .. thank you , you've been a life saver!

       
    • Peter S
      Peter S
      2005-04-13

      One clarification to my earlier post. The call:

      CalLoader::setLoadingMode(LOADER_INVERT_V_COORD)

      should be done before reading any character data.

       
    • Lex Yacc
      Lex Yacc
      2005-04-13

      Aha! The source for the rbodyTest demo is incorrect. This line is called in the standard demo way after the models are loaded.