Results 1 to 5 of 5

Thread: collada Unit

  1. #1
    coders_gaint
    Guest

    collada Unit

    <unit name="centimeters" meter="0.01"/>

    From the above line that i extracted from the collada file.I just like to know what actually collada does with centimeters or meter or feet.I found that this is used for scaling purpose.if so then what could make differences from centimeters,meter,foot etc.What collada do with centimeters......

    Thanks

  2. #2
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: collada Unit

    COLLADA stores the unit of distance measure of the real world values in the document or asset.

    It means that all the real world values of distance and position in the asset (document in this case) are in centimeters. For example, a vertex position of (1,2,3) means (1cm,2cm,3cm).

    If your application works in centimeters (like Maya) then you're fine.

    Otherwise you may have to apply the appropriate scale to bring the values into proportion with other objects that are modeled with a different measure of distance. For example, if your viewer is using meters (and you care, i.e. some tools are unit-less) then you would scale that vertex position to (.01m,.02m,0.3m) with the <unit> information.

    Examples of real world values affects by the unit of distance include:
    • position[/*:m:2rtx1zhu]
    • translate[/*:m:2rtx1zhu]
    • scale[/*:m:2rtx1zhu]
    • matrix[/*:m:2rtx1zhu]
    • lookat[/*:m:2rtx1zhu]
    • znear and zfar (of cameras)[/*:m:2rtx1zhu]
    • gravity[/*:m:2rtx1zhu]
    • animation data of any of the above[/*:m:2rtx1zhu]

  3. #3
    Junior Member
    Join Date
    Sep 2009
    Posts
    2

    Re: collada Unit

    Another question about the Unit.

    I would like to specify a unit in meters, instead of centimeters (as seen in most samples):

    Code :
    daeElement* unit = asset->add("unit");
    result = unit->setAttribute("meter", "1.0");
    assert(result);
    result = unit->setAttribute("name", "meter");
    assert(result);

    I don't get any assert, so I first guessed it was fine, but in the .dae my unit section is empty :

    <unit/>

    Any ideas about how setting a unit in meter ?

    Thanks

  4. #4
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: collada Unit

    You're probably okay. The default unit is meters in COLLADA, so probably the COLLADA DOM is not writing it out explicitly to save space.

    Btw: Maya default unit is centimeters and is probably the exporter of your documents.

  5. #5
    Junior Member
    Join Date
    Sep 2009
    Posts
    2

    Re: collada Unit

    You are right.

    After importing a model into GoogleEarth, my models are in meters.

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •