Viewing POD files

This topic contains 6 replies, has 3 voices, and was last updated by  Aaron 9 years ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #29599

    vezza
    Member

    Hi there,
    I’m quite new to the PVR stuff so excuse me is I ask stupid things…
    I am trying to do a simple viewer that loads and displays POD files; I want to export these files from Maya. I am running through several issues, and I list two of them here hoping there is an easy answer to them. Note also that i did not find any exhaustive doc about the POD format and how to use all its features; if that docs exists maybe I can find my answers there…

    • How do I display color materials? If I just load the POD, the scene has all the materials exported from Maya, with the proper names and values, but the objects show up in the default grey.
    • Same for textures… Do I have to explicitly handle for each mesh its material, bind to its texture and so on? I would expect the SDK to do that for me: when a mesh is to be drawn it should in some way provide helper methods to init its stuff.

    That’s it for now… thanks a lot in advance!

          Luca

    #32318

    Scott
    Moderator

    Hi,

     

    Yes you are correct for each mesh you need to handle the materials yourself. For an example of loading the colour materials from a POD file see OGLESMatrixPalette and for textures see OGLESIntroducingPOD. Thanks for the suggestion of helper functions, we’ll consider it for a future release.

     

    There is a brief description of the pod format in the PVRGeoPOD documentation and the source code for the pod loading tools should be commented but if there is something you have noticed missing then please let us know.

     

    Thanks,

     

    Scott
    #32319

    vezza
    Member

    Hi Scott,
    Thanks for your reply. In the meantime I’ve been able to put together a basic viewer that does all that. So I can now export a scene from Maya, and render it on a N93 with proper lighting and texturing.
    What I still miss is a general description of what’s behind the format, e.g. details of the coordinate system used. For that specific topic I still have troubles in understanding how my Maya scene is exported in the output POD files (as I see some rotation is going on in the export). See also this thread about that: https://www.imgtec.com/forum/forum_posts.asp?TID=96
    So, all in all I’m slowly progressing… Main issue now is understand in details how the Maya exporter works.

      Luca

    #32320

    vezza
    Member

    One more question, this time more related to the contents and structure of the POD data actually.
    I see that the SPODScene structure has an array of nodes (SPODNode*), which include nodes of all types: meshes, cameras, lights and so on. And the scene stricture has also a counter for how many nodes that array has and how many of them are meshes. Now, looking at the node structure, I don’t see any way to know what node type it points to. It just has an index, which is comment like this: “Index into mesh, light or camera array, depending on which object list contains this Node”. But how do I know which array this node refers to?
    In other words, when iterating on the node array, how can I know if a node is a camera or a mesh or what? The example apps seem to assume that the first nodes in the list are alwaysmeshes (and so you can draw them), the rest is contained in other dedicated arrays. But this seems a bit weak…
    Thanks,

         Luca

    #32321

    Aaron
    Member

    Hi,

    The order of the nodes array (SPODScene::pNode) is the following:

    SPODScene::nNumMeshNode objects, SPODScene::nNumLight lights, SPODScene::nNumCamera cameras, Everything Else (bones, helpers etc)

    The reason for this is simply that the typical usage is to iterate over meshes, lights or cameras etc and index directly into the node array. Iterating over nodes is often less common.

    Regards,

    Aaron.

    #32322

    vezza
    Member

    Hi,
    I see your point, but if I have to iterate over nodes (for example to copy the data into my own scenegraph hierarchy), then I can’t. And if for any reason I do the mistake of adding a node the indexing schema gets busted. If I had a flag on each node saying what type it is it would still work.
    Thanks for the clarification anyway.

        Luca

    #32323

    Aaron
    Member

    Just to be clear, the node array is sorted by type so you can calculate the node type fairly easily (no searching required). I could have left it entirely unsorted

    Some code I haven’t tried to even compile (it wouldn’t be happy with invalid node indices, for example):

    Code:
    enum ENodeType { eMesh, eLight, eCamera, eOther };

    static ENodeType CalcNodeType(unsigned int nNodeIdx, const SPODScene &scene)

    {

         // mesh?

         if(nNodeIdx < scene.nNumMeshNode)

              return eMesh;

         nNodeIdx -= scene.nNumMeshNode;

         // light?

         if(nNodeIdx < scene.nNumLight)

              return eLight;

         nNodeIdx -= scene.nNumLight;

         // camera?

         if(nNodeIdx < scene.nNumCamera)

              return eCamera;

         nNodeIdx -= scene.nNumCamera;

         // other.

         return eOther;

    }

    Aaron.

Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic.