Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Author Topic: Importer: material name parameter vs id  (Read 2005 times)

theshanergy

  • Member
  • **
  • Posts: 69
Importer: material name parameter vs id
« on: October 09, 2014, 12:25:38 am »

Just working on my first vehicle mod for Outerra and I must say, this engine is awesome!

On the topic of materials though I've run into a bit of a sore spot. I export models from Sketchup as dae (collada). This works great overall, however when generating the .mtl file Outerra seems to disregard material names.

As an example, the dae file contains a material declaration similar to the following:

Code: [Select]
<material id="ID179" name="dark_grey">
            <instance_effect url="#ID180" />
        </material>

From this, Outerra produces the following in the .mtl file:

Code: [Select]
{
"name" : "ID179",
"color" : ".518,.518,.518,1.0",
"f0" : ".027",
"roughness" : ".498",
"no_light" : false,
"alpha_masked" : false,
"tex_albedo" : "",
"tex_normal" : "",
"tex_roughness" : "",
"tex_opacity" : "",
"tex_reflectance" : "",
"tex_environment" : ""
},

For smaller models, it's easy enough to parse through the file manually and figure out which colors are which. When you have a larger number of materials in a model however, it can become extremely cumbersome locating individual materials in this file.

On the off-chance any of the devs are reading this - my suggestion would be to add the collada "name" attribute to the mtl array, if possible. Even just a code comment above the array would make the task of vehicle building considerably easier.

Proposed solution:

Code: [Select]
{
"id" : "ID179",
                "name" : "dark_grey",
"color" : ".518,.518,.518,1.0",
"f0" : ".027",
"roughness" : ".498",
"no_light" : false,
"alpha_masked" : false,
"tex_albedo" : "",
"tex_normal" : "",
"tex_roughness" : "",
"tex_opacity" : "",
"tex_reflectance" : "",
"tex_environment" : ""
},

or

Code: [Select]
// dark_grey
{
                "name" : "ID179",
"color" : ".518,.518,.518,1.0",
"f0" : ".027",
"roughness" : ".498",
"no_light" : false,
"alpha_masked" : false,
"tex_albedo" : "",
"tex_normal" : "",
"tex_roughness" : "",
"tex_opacity" : "",
"tex_reflectance" : "",
"tex_environment" : ""
},

If this isn't a desirable feature for whatever reason and nobody else has any suggestions for an improved workflow, then perhaps I will attempt a quick script for renaming material id's on a dae file directly. It would be awesome if this could be rolled directly into the importer though.

This engine excites me!
« Last Edit: October 09, 2014, 12:30:47 am by theshanergy »
Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2254
  • It´s way too complex, dont let me try to explain !
Re: Importer: material name parameter vs id
« Reply #1 on: October 09, 2014, 04:14:23 am »

Well, i always re-named my materials in some way before collada export (blender) keeping them names in check ...  Could this be a sketch-up export thing ? I mean, trying to look at Max and Blender export file material definitions, if its the same way ...

My mtl. construct from blender exported collada looks like :

Code: [Select]
{
"name" : "RedLight",
"color" : ".212,.011,.015,1.0",
"f0" : ".027",
"roughness" : ".498",
"no_light" : false,
"alpha_masked" : false,
"tex_albedo" : "",
"tex_normal" : "",
"tex_roughness" : "",
"tex_opacity" : "",
"tex_reflectance" : "",
"tex_environment" : ""
},
{
"name" : "BackSectFrame",
"color" : ".725,.725,.725,1.0",
"f0" : ".027",
"roughness" : ".498",
"no_light" : false,
"alpha_masked" : false,
"tex_albedo" : "Ural-4320-31_BackSection_Frame.dds",
"tex_normal" : "",
"tex_roughness" : "",
"tex_opacity" : "",
"tex_reflectance" : "",
"tex_environment" : ""
},

 

... so material names have no problem. In the collada file :

 
Code: [Select]
...
    <effect id="BackSectFrame-effect">
      <profile_COMMON>
        <technique sid="common">
          <phong>
            <emission>
 <color sid="emission">0.024 0.024 0.024 1</color>
            </emission>
            <ambient>
              <color sid="ambient">0 0 0 1</color>
            </ambient>
            <diffuse>
              <color sid="diffuse">0.02094074 0.03421766 0.005971481 1</color>
            </diffuse>
            <specular>
              <color sid="specular">0.03684241 0.06269211 0.0144585 1</color>
            </specular>
            <shininess>
              <float sid="shininess">50</float>
            </shininess>
            <index_of_refraction>
              <float sid="index_of_refraction">1</float>
            </index_of_refraction>
          </phong>
        </technique>
        <extra>
          <technique profile="GOOGLEEARTH">
            <double_sided>1</double_sided>
          </technique>
        </extra>
      ...
 

 ... BackSectionFrame is the name of the material in my vehicle. (i changed the material collor values in mtl of course)
« Last Edit: October 09, 2014, 05:10:11 am by PytonPago »
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

theshanergy

  • Member
  • **
  • Posts: 69
Re: Importer: material name parameter vs id
« Reply #2 on: October 09, 2014, 11:17:59 am »

That's interesting. I rename all materials in Sketchup before export but it always changes the id to some arbitrary number ("ID179" for example). I assumed the <material> tag was a standard implementation, but your export seems to work much better. Maybe I'll have a go at Blender, though I think the learning curve may be considerably steeper than Sketchup.
Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2254
  • It´s way too complex, dont let me try to explain !
Re: Importer: material name parameter vs id
« Reply #3 on: October 09, 2014, 12:27:34 pm »

Wont be much steeper ... doe, try before changing both ID and the name to the same thing ... i know from the few models i tryed to import from sketchup to blender, that in its own way of working, sketchup leaves a lot of junk behind ( you can look for the Bismark ship topic on the forum - right where i post Doctor Who photo :D ). I think by implementing an orginal way of modeling stuff, they had some not much compatible stuff there, witch partly exports to formats too ... an might be that some export coding has some of those features itself in material stuff.
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

angrypig

  • Outerra Developer
  • Sr. Member
  • *****
  • Posts: 454
    • http://outerra.com
Re: Importer: material name parameter vs id
« Reply #4 on: October 10, 2014, 04:52:56 am »

We are using ID for material names because it's mandatory attribute and in many application exporters it's the only attribute there. I will modify our import to use name if it's present but can't tell you when because we are  busy with other tasks now.
Logged