No announcement yet.

XML - LeafReferences material

  • Filter
  • Time
  • Show
Clear All
new posts

  • XML - LeafReferences material

    I am working on a conversion tool from SP8 to our internal format, and one thing that puzzles me is "Material" property in LeafReferences tag. What does this number mean?

    Lets say I export one of the built-in models where there are 2 materials
    <Materials Count="2">
    <Material ID="9999" Name="Broadleaf_Hero_Forest_Billboard_Mat" TwoSided="0" UserData="" VertexOpacity="0">
    <Map Index="0" Used="1" File="Broadleaf_Hero_Forest_Billboard_Color.png" />
    <Map Index="1" Used="1" File="Broadleaf_Hero_Forest_Billboard_Normal.png" />
    <Map Index="2" Used="1" File="Broadleaf_Hero_Forest_Billboard_SS.png" />
    <Map Index="3" Used="0" />
    <Map Index="4" Used="0" />
    <Material ID="12346" Name="Broadleaf_Hero_Forest_Mat" TwoSided="1" UserData="" VertexOpacity="0">
    <Map Index="0" Used="1" File="Broadleaf_Hero_Forest_Color.png" />
    <Map Index="1" Used="1" File="Broadleaf_Hero_Forest_Normal.png" />
    <Map Index="2" Used="1" File="Broadleaf_Hero_Forest_SS.png" />
    <Map Index="3" Used="0" />
    <Map Index="4" Used="0" />

    I have 3 leaf references in the object that look like this:

    <LeafReferences Material="1" Count="12">
    <LeafReferences Material="3" Count="303">
    <LeafReferences Material="9" Count="86">

    what do these 1, 3 and 9 mean when there are only 2 materials? I use SP v8.2.1, exporting via "Export to game..."


    PS: otherwise, the XML format seems really nice and reasonable

  • #2

    I think you may have found a bug. The material ID on the leaf references seems to be the original material ID, before the leaf materials were merged into the atlas. LeafReferences aren't used very often in games, so that bug must have slipped through. I will try to fix that and sneak it into v8.3, which should be out very soon.

    12345 and 12346 are special material IDs for the atlas. For now you could probably just assume leafrefs are referencing the atlas and use the atlas material for them. It looks like the UVs in the meshes referenced by the leafrefs are updated correctly for the atlas already.

    Hope this helps

    BTW, as a full games customer, you are free to use [email protected] for in-depth support questions.


    • #3
      it works now, but I've found another problem.

      I was given a simple test model, which I attach. It's an ST7 model that was opened in ST8 (8.3.0) and then exported as an XML, see the settings in the figure. The problem is that one of the objects has LeafReferences, but the leaves were not exported (there are no Meshes present in the XML).

      Settings used to export:

      Click image for larger version

Name:	setting.png
Views:	250
Size:	27.6 KB
ID:	6300

      The model file and the exported version is over here:



      • #4

        If it was a v7 asset, then meshes are not set up the same way as in v8. In v8, meshes are set on the materials and then applied to the tree that way.

        I can look into why v7 meshes aren't being reported to leafrefs correctly, but if you were to upgrade the v7 model to v8 generators, I imagine everything should work correctly afterwards.