Results 1 to 30 of 652

Thread: A start on the .MESH file format

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    The Philosopher Duke Member Suraknar's Avatar
    Join Date
    Dec 2002
    Location
    Navigating the realm of Ideas
    Posts
    707

    Default Re: A start on the .MESH file format

    hrm...

    This looks like Vertex Shading, Shininess and refraction in relation to weather lighting and environment, so it is information for the engine's rendering instructions.

    Just a thought, are these mystery values the same accross the board for all units?

    If they are then maybe the Converter could just add(insert) this information to the final .mesh file upon export?

    EDIT: NVM, I posted this after reading page 5 of the thread, did not notice there was Page 6, which I am reading now :P
    Last edited by Suraknar; 03-12-2007 at 03:19.
    Duke Surak'nar
    "Η ΤΑΝ Η ΕΠΙ ΤΑΣ"
    From: Residing:
    Traveled to: Over 70 Countries, most recent: and

    ~ Ask not what modding can do for you, rather ask what you can do for modding ~
    ~ Everyone dies, not everyone really fights ~

  2. #2
    Member Member KnightErrant's Avatar
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    458

    Default Re: A start on the .MESH file format

    Yes, the format seems to be the same for all units.
    The aztec variants that Casuir found had float triple
    streams for the mystery data but those units aren't
    used in-game (don't appear in the EDU) so were they
    mistakes, early prototypes with a different format, etc. ?

    Did a quick google on normal map tutorials and there
    are a few so maybe I should just read up for a few evenings
    until I can catch up.

  3. #3
    Member Member Re Berengario I's Avatar
    Join Date
    Nov 2003
    Location
    Italy
    Posts
    336

    Default Re: A start on the .MESH file format

    For what you are interested in a normal map it's just another texture because most of the 3d programs know how to handle it. It's not geometry for them.

    From the Caliban post I understood that the mystery block values are the tangent and biNormal (bitangent) vectors of the model to support normal mappin in per pixel lighting through shaders.
    Last edited by Re Berengario I; 03-12-2007 at 03:27.

  4. #4
    Member Member Re Berengario I's Avatar
    Join Date
    Nov 2003
    Location
    Italy
    Posts
    336

    Default Re: A start on the .MESH file format

    Ok, because I need to be forgiven for the last cryptic post this is a good and simple tutorial about the argument:

    http://www.3dkingdoms.com/tutorial.htm

    and this for tangent space normal mapping

    http://www.3dkingdoms.com/weekly/weekly.php?a=37
    Last edited by Re Berengario I; 03-12-2007 at 03:31.

  5. #5
    Member Member KnightErrant's Avatar
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    458

    Default Re: A start on the .MESH file format

    Well when GrumpyOldMan comes online he'll understand this
    so I guess I shouldn't be too worried about my ignorance.
    What I would like is an assurance of is this data computable
    from the vertex vectors, weights, and uv coords so that when
    we pull all of that out of a mesh and put it into the .ms3d
    format (which wants the vertex normals) can we go back the
    other way and put it all back into the mesh format and compute
    all the required mystery data. (I realize we may be "talking past each other"
    on this question, I see this problem from data in a file format and you
    guys who actually make models may be seeing this as something
    you apply in a given application.)

    Edit: You're too fast, I didn't even get a chance to see that.
    I'm going off to study this stuff and then I'll understand it better.
    Many thanks for being patient with me.

    2nd Edit: Yes, that's the tutorial I found. Reading it now.

    3rd Edit: THANK YOU! This has math in it. Now I'll understand what we've
    been talking about.
    Last edited by KnightErrant; 03-12-2007 at 03:44.

  6. #6
    Member Member Re Berengario I's Avatar
    Join Date
    Nov 2003
    Location
    Italy
    Posts
    336

    Default Re: A start on the .MESH file format

    I don't possess deep knowledge on normal mapping as I usually let the 3d application handle it but in this case they use directly a shader so those values (if I'm not completely wrong) are a 3x3 matrix for each mesh vertex.

    (From the second link above:)
    To use tangent space normal mapping, we need to send the tangent and bitangent vectors to the vertex shader. Then we can create a 3x3 rotation matrix from them that can be used to rotate vectors such as the light vector and half-angle vector into tangent space.
    Now we can dot these vectors with a normal from our tangent space normal map, using the same pixel shader as with object space normal mapping.


    From Caliban's post:

    To get more info about what tangent and binormal is, they should look up tangent space normal mapping as that's what we're using. Mesh needs to contain valid tangent space (normal, tangent & binormal).
    Last edited by Re Berengario I; 03-12-2007 at 03:43.

  7. #7
    Member Member KnightErrant's Avatar
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    458

    Default Re: A start on the .MESH file format

    Exactly! from the same article

    Code:
    void ComputeTangentBasis(
          const Vec3& P1, const Vec3& P2, const Vec3& P3, 
          const Vec2& UV1, const Vec2& UV2, const Vec2& UV3,
          Vec3 &tangent, Vec3 &bitangent )
    {
       Vec3 Edge1 = P2 - P1;
       Vec3 Edge2 = P3 - P1;
       Vec2 Edge1uv = UV2 - UV1;
       Vec2 Edge2uv = UV3 - UV1;
    
       float cp = Edge1uv.y * Edge2uv.x - Edge1uv.x * Edge2uv.y;
    
       if ( cp != 0.0f ) {
          float mul = 1.0f / cp;
          tangent   = (Edge1 * -Edge2uv.y + Edge2 * Edge1uv.y) * mul;
          bitangent = (Edge1 * -Edge2uv.x + Edge2 * Edge1uv.x) * mul;
    
          tangent.Normalize();
          bitangent.Normalize();
       }
    }
    This is exactly the education I was looking for. Thank you very much
    Re Berengario I. I'm am deeply in your debt.

  8. #8
    The Philosopher Duke Member Suraknar's Avatar
    Join Date
    Dec 2002
    Location
    Navigating the realm of Ideas
    Posts
    707

    Default Re: A start on the .MESH file format

    KE,

    Just as a small test here,

    when you compare feudal_knightslod0 and feudal_knights_lod1, is the mystery bytes information the same?
    Duke Surak'nar
    "Η ΤΑΝ Η ΕΠΙ ΤΑΣ"
    From: Residing:
    Traveled to: Over 70 Countries, most recent: and

    ~ Ask not what modding can do for you, rather ask what you can do for modding ~
    ~ Everyone dies, not everyone really fights ~

  9. #9
    Member Member KnightErrant's Avatar
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    458

    Default Re: A start on the .MESH file format

    No, in all the "normal units" I've looked (a very small subset unfortunately)
    the lod1, lod2, and lod3 only have one mystery block, set off with a
    granny int of 3 0 0 0 which, according to Caliban's info, means normal
    info only, no tangent or binormal. Is that significant?

    Edit: Sorry, if you're asking if the first mystery block is the same for
    each lod I don't know. I can find out but I have to run some examples.
    Last edited by KnightErrant; 03-12-2007 at 04:16.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO