Page 1 of 1

C++ code for reading Indigo materials

Posted: Thu Mar 05, 2009 9:25 pm
by OnoSendai
Hi all,
I'd love to see some of the exporters for various modelling packages support importing Indigo materials, so that the MatDB can start becoming really useful.
But I realise that writing the code that can process a .igm file can be pretty difficult and time-consuming, especially when you have to cope with backwards compatibility in material XML specification.
So I'm releasing some C++ code that can parse Indigo materials, given the XML element. The XML parsing itself is done with TinyXML.

For the people that are working on an exporter that doesn't use C++, well, at least the code can provide a guideline of what needs to be done.

I've just been working on this over the last few days, so it's not fully tested yet.
However, this code should be pretty complete, and will be maintained in the future, as it's now also the code that Indigo uses to parse material XML.

Any feedback is welcome. Is this useful for exporter authors?

Re: C++ code for reading Indigo materials

Posted: Thu Mar 05, 2009 9:40 pm
by fused
OnoSendai wrote:Is this useful for exporter authors?
Yes!

Posted: Thu Mar 05, 2009 10:07 pm
by suvakas
Great idea !
Can't use it from Maxscript, but still..very good idea.

Posted: Fri Mar 06, 2009 12:19 am
by CTZn
Nice move Ono !

This can certainly avoid some hassle and borrow some incertitudes (design wise), aye to the guidelines !

Posted: Fri Mar 06, 2009 2:18 am
by rgigante
:shock: A lot of great thing to study and apply!

Thanks, really really appreciated...(psss IT4XSI supports IGM since long ago :wink: )

R.

Posted: Fri Mar 06, 2009 2:49 am
by Whaat
Great! Thanks Ono! This is sure to be extremely useful for all exporter writers. I just wished I had asked for this a long time ago... :) My material import code is almost done, I just need to spend about a week bug-fixing and testing it. :)

Posted: Fri Mar 06, 2009 12:31 pm
by fused
hey nik,

i dumped the old cindigo import code and completed the material import using your parser. still need to do the texture loading (yeah, i said itll be ready today, but i got heavily distracted by MGS4, Mirrors Edge and failblog.org ^^ ).
on the way i noticed that i really have to rewrite the material helper... im not sure if i can do that before 1.1 stable.

i also have a little problem here: it seems the gamma value in the RGB spectrum is missing!

Posted: Fri Mar 06, 2009 2:01 pm
by OnoSendai
fused wrote: i also have a little problem here: it seems the gamma value in the RGB spectrum is missing!
Hi Fused,
sorry, what exactly do you mean by that?

Posted: Fri Mar 06, 2009 9:34 pm
by fused
OnoSendai wrote:Hi Fused,
sorry, what exactly do you mean by that?
i mean that there is no gamma variable in the IndigoRGBSpectrum but the xml rgb spectrum can hold rgb and gamma.

edit: i had a closer look at your source code and gamma is parsed and the color gets reverse gamma corrected... but im not sure if this is suitable :) (at least for my needs)

edit2: also i couldnt find a function for parsing mediums

Posted: Sat Mar 07, 2009 11:54 am
by OnoSendai
Parsing media is not supported in the Indigo Utils yet, because strictly speaking they're not materials. However, since they are needed for .IGM import, I might add them in.

Posted: Sat Mar 07, 2009 1:42 pm
by fused
no problem, since they didnt change at all in the last material specs i still have the old code which is working ok for now.

Posted: Sun Mar 08, 2009 3:24 pm
by OnoSendai
Updated to v2 with some backwards compatibility fixes.

Posted: Sat Mar 28, 2009 11:16 am
by fused
im having some problems with gcc and exceptions with the indigo utils.

without -fexceptions im getting errors on try {} catch {} and with on throw...
cant tell more about right now, but maybe sounds familiar for someone :)