Page 1 of 15

Indigo 0.7F exporter here! Features added/Comments welcome!

Posted: Sun Jan 14, 2007 6:32 pm
by Wedge
Hello everyone, I'm new. I have started using blender and indigo at around the same time and started with indigo 5t7. I have enjoyed seeing the progress made with all three programs, that is, blender, indigo, and the exporter. Now 3d graphic is a hobby of mine (I have a nice scene I have made but have not currently let it render long enough to post it) and its been awhile since I felt able to contribute to something. So I thought now is the time.

If you haven't seen my post in the other thread, I reported that I was working on the exporter for 07 and I'd like to join the team. I think if we get organized we can solve different problems and the same problems together. I think organized is the best way. That way we don't each write our own exporters and it ends in confusion for everyone trying to figure it all out. I know it will likely be a forum type of teamwork, since we are all over the world and when some people are sleeping some are awake and so on. So a sort of tag-your-it type of meetings we could have over the course of some days where some things can be brought to attention then worked on for awhile, tested, and posted.

This script was based on the 'current dev version' from the wiki page listed from the download/exporter section. I think it is the same as exporter 6t6 b1. I have tried to test it to make sure it was working okay before I post an update, but it can still be buggy. Some code may have been deleted by accident or for a reason.

I have changed many things and right now much may break if you click the wrong button. I'm quite nervous my hands are shaking. This has been a big project for me over the last few days so I hope everyone can play around with it and enjoy it for what it is.

Here's my known changelog, things that I thought were too little to list / or forgot to list are not listed:

fixed = using rotation matrix that Zuegs posted (I modified scale variable) *Thanks Zuegs*
fixed = some default options reset to settings listed in indigo 0.7 inifile

optimized = geometry
bugfix = ignores faceless objects

added = support for large meshes
added = primitive support (rectangle light, sphere, plane) *Thanks to Kram1032 for the info*
added = new light power system for all emitters
added = halt time, image save time, num threads, updated gui
added = SSS dermis/epidermis/Henyey Greenstein support
added = phong material / blend material support
added = autofocus feature
added = bloom setting to camera
added = normal smoothing (to use: press the set smooth button from edit menu for each desired mesh)

Thanks to all for providing fixes in the forum and I have adapted the ones I saw into the script. Thanks for testing, reporting bugs, helping solve bugs, new ideas for script and stuff like that. Please feel free to let me know if your code is in there but no credit comment is near it. I have done my best to add credit and add fixes as fast as possible so I was able to provide something for you to try. So check it out, read it and learn it if you want. Most of it is easier than it looks to understand.

Feedback is welcome! & comments....More than anything else, enjoy using it and have fun! Thanks!

Edit: I would like to say thank you to everyone that used and tested this exporter. This script is no longer being developed by me. I have now moved to version 08 of exporter. Version 1.21 fixes major bug. Version 1.20 Finally finished cleaning/merging extra code created for large mesh support. Version 1.18 maintenance release. Version 1.17, mainly a maintenance release. I'm not sure how 6t6 exporter handled layers...but since I know they are useful I wanted to have a look at what I could code that might be helpful. Now it is set so that an object viewable in layer 7 when you render layer 5 will be ignored and an object viewable in more than one layers only exports once.
Version 1.14: bug fix for camera *Thanks Scorpius*, removed MLT button from GUI
New release for Indigo 07T7. The script graduated from beta stage and is moving on to a simple version numbering system. Bug fixes for primitives, they no longer crash the exporter when you forget to apply a material on them. (instead they receive default values) If you want to set up a mirror now just ignore setting a exponent and push the RayMirror button and it will apply a 1 million exponent value. Save IGI, Display Period, Polarisation, and Super Sample Factor are all in the GUI now. Minimum seconds for display or save are now raised to 30 seconds. With saving igi files and using bloom I think it is better to raise these values to slower intervals. Enjoy!
I am thinking of slowing down work now to get ready to enjoy the spring season.

Fixed separate materials feature. *Thanks locke* Added support for large meshes. Put fresnel scale back into phong material. *Thanks Fip 2*

-sorted white balance from blue to red based on temperature
-saved tonemapping settings while working with a scene
-removed inverted colors from henyey greenstein (no longer absorbs)
-removed global color gamma exponent
-removed global texture exponent
-removed medium name tag .medial
-removed multiplier from rgb emitter, 0-1 works fine with new light power system
-removed confirmation menu from exiting exporter, now just exits when you push ESC
-increased image save time range to 15 (900 seconds) minutes from 10 (600 seconds)
-added per-texture exponent set by texture/map to/col slider (just above nor) - result is col*10 or .1 = 1
-changed absorption/scattering rgb values, now show up exactly inverted from what you entered
-added absorb/scatter rgb/uniform multiplier 1000
*To use absorb multiplier: if RayMirror rayMirr slider is > 0 use *1000 multiplier, else use value according to directions
*To use scatter multiplier: if RayMirror Fresnel slider is > 0 use *1000 multiplier, else use value according to directions
**RayMirror does not have to be activated to use the RayMirr or Fresnel slider multipliers

See above for features / below for directions. Enjoy!

This script requires Blender 2.43 and Indigo 0.7 Final to work. Only mesh objects are supported.

"Note: for people wanting to use multiple hardness/exponent levels of .nk materials, just add numbers to the end like .nk1 .nk2 and the exporter code takes care of the rest *brought to my attention by Phil, thanks Phil!, solved also by Zuegs! Thanks to both of you. I just found this out myself while testing, looking for a fix for something that was already done. Interesting, I am embarassed!"

Directions/news you can use:

Variables that will still cause memory errors: You can still have memory errors from what I can see. These will happen because there are still some variables in mesh data: - signs that follow vertex pos or normals tags, uv mapped meshes, and layout/type of the mesh. If you have any memory errors and want to let me know please report to me the last few lines of the Blender console error message and line that created the error. Include also the type of mesh (sphere, hand made house, big monster, etc) that caused the error if you know which mesh it is, if it is uv mapped, and the size of the mesh (verts/faces). From here, I should be able to split the mesh into more pieces or alter these functions to fix the problem. Thanks!

From Zuegs: @Mute:
ensure every objects scale is equal for all 3 directions X,Y,Z - all uneqal scaling should be applied to the mesh (not the object) - use Ctrl-A to apply objects asymmetric transformations to the underlying mesh in your case
hope it help, regards, zuegs

From Zuegs: You can use Alt - D in blender or duplicate linked to activate instancing.

Primitives: You must scale sphere primitive in object mode only. Any scaling to it in edit mode will result in errors.
* .rlight to mesh name enables rectangle light, this is a blackbody light using the new light power system, width and height adjusted by adding to mesh name, for example cube.rlight.width.height where width and height are integers
* .plane to mesh name enables plane, <dist> tags are adjusted by adding to mesh name, for example wall.plane.dist where dist is an integer, normal tags are fixed values, must edit in XML
* .sphere to mesh name enables sphere
(all other options not marked as fixed, are set as usual)
(I recommend that you use a mesh uvsphere for .sphere, mesh plane for .plane, and mesh cube [or plane maybe, I did not test?] for .rlight when you use the primitives.) *Thanks zsouthboy for mesh info*

Blend material:
* material name needs .blend.a.b where .blend sends it to exporter as a material blend, a and b is the blended materials which can be any name you see fit but you will probably notice that you need to keep name fairly short or you will run out of space
* first material (a) color is defined by color RGB
* second material (b) color is defined by specRGB
* translucency == 1 = use null_material for .a material else rgb
* alpha < 1 = use null_material for .b material else rgb
* ambient == blend_factor value

Emitter settings:
* hard = power drawn value
* spec = overall luminous efficacy value (spec*100)

Bump map <b> tags: set by nor slider, result is (nor/10), so .1 gets exported as .01

Medium Settings:
* IOR = ior from blender
* cauchy b coeff = filter from blender
* absorption spectrum <rgb> = set with colors
* precedence = specular (*10) so .2 spec gets less pecedence than .3 specular
* translucency == 0 `glossy_transparent tags where hardness *10 sets exponent, else specular tags
* Ray Transparent button must be enabled for SSS/medium
* reflection (the one above spec) > 0 *set absorbtion coefficient uniform tag/value (reflection*10), else use rgb diffuse color sliders
* dermis / epidermis, see below

* add .der to material name to enable, for example skin.der
* hemoglobin_fraction set by SpecTransP slider

* add .epi to material name to enable, for example skin.epi
* melanin_fraction set by Ref slider (right above spec and hard sliders)
* melanin_type_blend set by Alpha slider

SSS settings:
ambient = 1 `SSS on, else SSS off
specTransparent > 0 *sets scattering coefficient uniform tags/value (spectransp*10) else rgb, which is set by spec color sliders
fresnelTrans == 0 *sets phase function uniform tag, else use henyey greenstein tag
alpha < 1 *sets g_spectrum uniform tags/value (alpha*10), else use rgb mirror color sliders

Camera settings:
Camera DOF and lens set in Blender under editing menu for camera.

Render size:
Render window size and % percent buttons to alter size are now adjusted from Blender's Render window. (25 50 75 100%, buttons near Render button)

*Thanks for comments/testing!

Posted: Sun Jan 14, 2007 8:56 pm
by cooler_inc
Hi, Wedge!
You did a big work, but the script is not working. When I'm trying to export the basic scene I've got an error :(

Code: Select all

File "<string>", line 873
IndentationError: unindent does not match any outer indentation level
And BTW I cannot see the Script Export Menu because of the error message.

Could you take a look what's wrong?
Thanks in advance.

Posted: Sun Jan 14, 2007 9:09 pm
by Wedge
Certainly, I have discovered dirty whitespace in the exporter. Over time, as it was reworked over and over and over dirty whitespace added up, what I mean by dirty is tabs and spaces acting as tabs, tabs + spaces do not mix when posting in the forum.

I have hand-checked every single line me and the error have faught through the entire code, I'm now at the very bottom so 5 more minutes and I'll test it one last time and paste the new one right in.

Posted: Sun Jan 14, 2007 9:37 pm
by cooler_inc
Sorry, not working :(

Code: Select all

Error loading script: couldn't open file C:\Program Files\ Blender Foundation\Blender\.blender\scripts\indigo
I use Blender 2.42a

Posted: Sun Jan 14, 2007 10:41 pm
by Wedge
That is interesting and unfortunate. I am indeed using Blender 243 RC1 with the latest 2.4 python installed. I am not quite sure why it won't load in 242, no core changes were made, like importing a new feature or anything that I know of.

Are you also using the latest python?

I have absolutely no idea why it will not load for you...

I'll have another look in my code, and at some blender documentation to make sure I did not add anything major.

Before I posted the last whitespace clean version, I ran it through blender, studied the xml result, and let indigo render it for a few minutes and all went well.

It is odd that this one will not load, since you loaded the last version when I pasted it with about 95 % clean whitespace, which means it ran through almost all of the code in the script before it reported the error in line 850+.

Edit: Just to be sure: Did everything go ok on your end, it is quite a lengthy code to copy and paste? I tried to make the font smaller but inside a code block it refuses to shrink. And your file has a .py extension? Also the reason I listed notepad to save it, so that the text doesn't get bloated with encoding or something from a more complicated word editor.

Please don't think I'm assuming you did anything wrong. I also found when I copied and pasted my test version that I had spaces in the top or bottom of the code. To be correct the #!BPY stuff is on the first line and the Draw.Register(gui, event, buttonEvt) stuff closes it out.

Posted: Sun Jan 14, 2007 10:48 pm
by Silverman
It worked for me using Blender 2.42a. :D

Any chance of adding the feature of exporting the mesh geometry to a separate file, like u3dreal did in Blender2Indigo 062beta1? or maybe adding the launch of Indigo from within Blender.

Thanks for making an exporter for version 07 so fast! :)

Posted: Sun Jan 14, 2007 10:57 pm
by Wedge
Sounds good, I'd like to get in a team with the export devs here and we can rock on solving together.

It is mainly why I wanted to clean the code and post it in text on the forum knowing there was a good chance it would cause trouble until I cleaned it. That and thanks to the forum for having a code block feature. Now we can observe all the code together in very readable form right here on the forum.

There is however something that still is happening to the code when pasted in the forum, it seems to have lost a tab indent.

Edit: (I'm already over using the edit button!!) oops, I'm glad to hear it works on 242, hopefully it is not a python issue. I think, is it mac are still at python 2.3??

Posted: Sun Jan 14, 2007 11:41 pm
by zuegs
Hi Wedge,

nice to have your help to get the exporter ready for v0.7
Currently u3dreal is working on the new exporter for v0.7 based on the v0.62 exporter from other thread. I think it would be the best way to wait for u3dreal's v0.7 exporter and get over your changes to his version (not to lose the new GUI and features from v0.62 exporter now) as your version is based on an older v0.60t6b1 i think.

I had a look on your blackbody gain changes:

Code: Select all

#Wedge: Completely messed up in this version so it works with sun, using loop to determine a multiplier 
            if (mat0.amb*10000 <= 500): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 100000000000000000000))) 
            elif (mat0.amb*10000 > 500) and (mat0.amb*10000 <= 1000): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 10000000000))) 
            elif (mat0.amb*10000 > 1000) and (mat0.amb*10000 <= 1500): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 10000000))) 
            elif (mat0.amb*10000 > 1500) and (mat0.amb*10000 <= 2000): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 1000000))) 
            elif (mat0.amb*10000 > 2000) and (mat0.amb*10000 <= 2500): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 100000))) 
            elif (mat0.amb*10000 > 2500) and (mat0.amb*10000 <= 3000): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 10000))) 
            elif (mat0.amb*10000 > 3000) and (mat0.amb*10000 <= 3500): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 10000))) 
            elif (mat0.amb*10000 > 3500) and (mat0.amb*10000 <= 4000): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 10000))) 
            elif (mat0.amb*10000 > 4000) and (mat0.amb*10000 <= 4500): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 10000))) 
            elif (mat0.amb*10000 > 4500) and (mat0.amb*10000 <= 5000): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 10000))) 
            elif (mat0.amb*10000 > 5000) and (mat0.amb*10000 <= 5500): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 10000))) 
            elif (mat0.amb*10000 > 5500) and (mat0.amb*10000 <= 6000): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 10000))) 
            elif (mat0.amb*10000 > 6000) and (mat0.amb*10000 <= 6500): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 1000))) 
            elif (mat0.amb*10000 > 6500) and (mat0.amb*10000 <= 7000): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 1000))) 
            elif (mat0.amb*10000 > 7000) and (mat0.amb*10000 <= 7500): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 1000))) 
            elif (mat0.amb*10000 > 7500) and (mat0.amb*10000 <= 8000): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 100))) 
            elif (mat0.amb*10000 > 8000) and (mat0.amb*10000 <= 8500): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 100))) 
            elif (mat0.amb*10000 > 8500) and (mat0.amb*10000 <= 9000): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 100))) 
            elif (mat0.amb*10000 > 9000) and (mat0.amb*10000 <= 9500): 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 100))) 
               str += "\t\t\t\t<gain>%.3f</gain>\n" %(mat0.emit / (5.6705 * (mat0.amb / 100))) 
The old formula "1/(5.6705e-8*pow(mat0.amb*10000, 4)))" was there for compensaton the gain depending on blackbody temperatur as physicaly defined by the "Stefan-Boltzmann Law" and it should infact do the same thing as you do now by your "elif"-loop ???

Regards, zuegs

Posted: Mon Jan 15, 2007 1:34 am
by Mute

Code: Select all

SceneLoaderExcep: Rotation matrix must be orthogonal
However i use the last indigo07 exporter :roll:

Posted: Mon Jan 15, 2007 1:38 am
by afecelis
Great work Wedge! You could also consider uploading the python script somewhere since in the copy-pasting process the code sometimes gets screwed because of bad indentation options of the editor you paste it into.
And I also agree with Zuegs; it's a great start, but U3dreal's new UI is a better approach that reflects the options in a simplified and optimized way; so it will be great once he releases his to join efforts and look into the 0.7 script together :wink:

I'm trying it out now.

Posted: Mon Jan 15, 2007 2:15 am
by zuegs
ensure every objects scale is equal for all 3 directions X,Y,Z - all uneqal scaling should be applied to the mesh (not the object) - use Ctrl-A to apply objects asymmetric transformations to the underlying mesh in your case
hope it help, regards, zuegs

Posted: Mon Jan 15, 2007 3:15 am
by afecelis
works fine; too bad it has to opened thru the text editor and run with "alt+p" (old way, ehehehhe) but loads and looks ok. Got this error though:
I thought the IOR info thingie was converted on export. :?

Posted: Mon Jan 15, 2007 3:17 am
by Mute
zuegs wrote:@Mute:
ensure every objects scale is equal for all 3 directions X,Y,Z - all uneqal scaling should be applied to the mesh (not the object) - use Ctrl-A to apply objects asymmetric transformations to the underlying mesh in your case
hope it help, regards, zuegs
it works :D


Posted: Mon Jan 15, 2007 3:38 am
by afecelis
Just tried a simple scene created from scratch without glass materials and it works fine. But then, how must we set the glass material in blender to get it exported properly?

Posted: Mon Jan 15, 2007 5:24 am
by zuegs
hi afecelis,
specular materials seems not to be implemented correctly in this exporter for v0.7t1. The "ior" tag needs to go in a "medium" block that then is used inside "specular".
See Ono's first post on v0.7t1 and change lines in XML :wink: