Guide For Exporter Writers

A forum for exporter development discussion.
User avatar
OnoSendai
Developer
Posts: 6237
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Guide For Exporter Writers

Post by OnoSendai » Sat Jan 20, 2007 4:34 pm

Hey all,
I thought I'd write a guide for exporter writers.
This is so we can have a bit more consistency between different exporters,
also it has some defaults that I'd like to see.

Please consider this a guide, as opposed to strict requirements.
Feel free to comment!

---------Option overload------------
Just because an Indigo configuration option exists, it does not mean it should be displayed in the export GUI.
Some of the configuration options are there just because it's more convenient for me to soft-code them rather than hard-code them.
The majority of users won't need to, or want to, tweak their values.

Also, values should only be included in the 'renderer_settings' XML element if they are needed. Putting all values in their just means that the inifile becomes useless.

So, please do not include the following configuration parameters in the exporter GUI, and do not write them to the 'renderer_settings' element.

* large_mutation_prob
* max_change
* max_depth
* frame_upload_period
* cache_trees

If advanced users really want to change these values, they can hand edit
the inifile.


---------Camera Settings----------------
aperture_radius: please make the default a plausible value,
e.g. 0.002m (2 mm).
A depth of field effect is very important for generating realistic images,
so the default should give a DOF effect.

<autofocus/>: please include the autofocus tag by default (autofocus on by default in the GUI)


Indigo camera model diagram:

Image

Let
w = sensor width
L = lens-sensor dist
a = angle of view

then from the diagram above,
a = 2*arctan( w/(2*L) )

F-number

The f-number (f-stop) controls the camera aperture radius, and is probably a more natural way to set the aperture than dialing in the aperture radius directly.
http://en.wikipedia.org/wiki/F-number

Now that Indigo has a tonemapping mode designed to model real digital cameras, it's essential that the aperture radius is set correctly from the f-number.

We have
N = f / d
where
N = f-number, f = focal length, d = aperture diameter.
Therefore
r = f / (N*2)
where
r = aperture radius.

It should suffice to take the Indigo lens-sensor distance as the focal length.
therefore the final equation for the aperture radius is

Code: Select all

aperture_radius = lens_sensor_dist / (N * 2)
Where N = f-number.

General procedure for setting the camera settings

1) Use a sensor_width of 0.036 m (36mm).

2) Compute the aspect ratio as image width / image height.
(will be e.g. 1.33 for landscape image)

3) Get the horizontal FOV from the modelling program.

4) Compute the lens_sensor_dist as

lens_sensor_dist = sensor_width / (2.0 * tan(FOV / 2.0))

5) Assuming the user has to enter a f-number (f-stop), we can compute
the aperture radius as so (same eqn as earlier):

aperture_radius = lens_sensor_dist / (f_number * 2.0)

-------- Getting the Indigo Directory Path --------

As of Indigo version 2.0.3, at least on Windows, you can use the registry to get the path to the directory that Indigo is installed in.
The registry key is
HKEY_CURRENT_USER\Software\Glare Technologies\Indigo Renderer\InstallDirectory
You can also get the installed version from
HKEY_CURRENT_USER\Software\Glare Technologies\Indigo Renderer\InstalledVersion
In this way you could show an error message if the Indigo version is unsupported.


------- Location of temporary files ----------
On Windows Vista, programs generally can't write to their own directory, if they are installed to 'Program Files' or 'Program Files (x86)'. So don't try and write there. Instead, retrieve the APPDATA directory, and write the files there. See http://msdn.microsoft.com/en-us/library ... 85%29.aspx for more information.

------- Validity of Scene Files ------
Scene files exported by the exporter, if an error message is not raised in the modelling package, should always be valid scene files. This means that they should not raise any errors in Indigo.

If the scene is not complete or is internally inconsistent, for example there is a mesh that uses a texture, but does not have UV coordinates, then an error message should be raised inside the modelling package. This is important because
* It gives earlier feedback to the user, so they can fix the problem sooner, rather than waiting for the export and import into Indigo to complete.
* It is possible to give an instructive error message, that includes specific instructions on how to fix the problem, in the current modelling package. Indigo must, by necessity, only provide general error messages that are suitable for all modelling packages.


------- Installation ------
All exporters should have an installer.
On Windows, use NSIS:
http://nsis.sourceforge.net/Main_Page

On MAC, use PackageMaker.

On Linux, just tar and gzip the program.
Last edited by OnoSendai on Wed Oct 24, 2007 9:23 pm, edited 8 times in total.

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Post by CTZn » Sat Jan 20, 2007 5:36 pm

I would plead for an advanced tab with these options; I'm bypassing the inifile all the time :oops:

I feel guilty now...
Last edited by CTZn on Wed Feb 28, 2007 5:07 am, edited 1 time in total.

User avatar
OnoSendai
Developer
Posts: 6237
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Sat Jan 20, 2007 5:50 pm

Yeah, an advanced tab could be a good alternative to just getting rid of the parameters I listed. Either way, they shouldn't be in the main area of the GUI.

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Post by CTZn » Sat Jan 20, 2007 5:57 pm

Cool, thank you Ono !

Er... someone willing to make that exporter for Indigo 0.7 on Maya ?

:mrgreen:

User avatar
arneoog
Indigo 100
Posts: 504
Joined: Sun Jun 25, 2006 2:19 am
Contact:

Post by arneoog » Sun Jan 21, 2007 12:28 am

Thanks, Nick :D

CTZn, I will start on the 0.7 Maya exporter soon..
Just need to wake up a bit more right now :P

*going to eat some breakfast*

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Post by CTZn » Sun Jan 21, 2007 3:23 am

That's rocking news, Arne !

I was considering learning further MEL myself to update some stuff in the exporter (I can roughly decypher what's going on if I put some work into that). I was thinking of using the Surface Shader to define medium... Ok, let's create a new thread !

:D :D :D

User avatar
oodmb
Posts: 271
Joined: Thu Oct 26, 2006 5:39 am
Location: USA
Contact:

installer

Post by oodmb » Sun Jan 21, 2007 3:24 pm

while you have a thread with some talk of environment variables, i would like to bring up the option of an installer that performed a registry edit so that exporter writers could have a much easier time coding there exporters to execute indigo with a little run button and having the exporter edit the infile. i recomend something that would add an environment variable for windows.
a shiny monkey is a happy monkey

Wedge
Posts: 441
Joined: Sun Jan 14, 2007 11:33 am
Location: East Coast, USA

Post by Wedge » Mon Jan 22, 2007 2:23 pm

Will do Nick. I have a new version of the blender exporter ready to put up in a few hours I will strip those render_settings out of the gui and make the necessary changes.

I will have a look also at the camera settings.

Thanks for the guidelines!

Update: I know its a few days after I posted so I don't know how long it will take to notice this but is there any other options that should be removed from the exporter?

In the blender exporter it has, metropolis, bidirectional, russian_roulette_live_prob, max_num_consec_rejections, and strata width.

Should they be in the exporter as available overrides? Or should they only be in the inifile you made so that advanced users can override but new users don't need to see and therefore not have to worry about?

I personally only have changed bidir on and off, as well as tried playing with the max_num_consec_rejections option back when the thread in the forums was talking about fireflies not going away from an image. Maybe only these two options should be left in the blender exporter gui? Or maybe all of the ones listed above should be left as they are? Or should they all be removed so you can control them from the inifile?

I know these settings are missing from your above post so I thought it would be best to ask.
Content contained in my posts is for informational purposes only and is used at your own risk.

Jananton
Posts: 66
Joined: Sun Dec 31, 2006 12:56 pm
Location: Amsterdam, The Netherlands

Post by Jananton » Fri Jan 26, 2007 11:16 am

Hello Ono,

I presume this isn't only for the v 0.7 version :?: , because in that case some stuff can be removed from the 0.6 exporter as well...
OnoSenday wrote:So, please do not include the following configuration parameters in the exporter GUI, and do not write them to the 'renderer_settings' element.

* large_mutation_prob
* max_change
* max_depth
* frame_upload_period
* cache_trees
Afaik cache_trees is the only one not changable in 63beta4. Do the others need to be removed in your opinion there too...
<autofocus/>: please include the autofocus tag by default (autofocus on by default in the GUI)
This tag is something for the 0.7 version I presume, otherwise if available it can be implemented in 0.6 script probably, although there are some quite nice focusing options implemented here ihmo...

Greetings from nighttime Amsterdam,

Jan

User avatar
manitwo
Posts: 1029
Joined: Wed Jul 05, 2006 4:50 am
Location: Tirol - Austria

Post by manitwo » Fri Jan 26, 2007 11:44 am

I think it would be good to have following parameters
included into an exporter:
- width
- height
- metropolis
- bidirectional
- max_num_consec_rejections
- polarisation
- super_sample_factor

the others are imo not really neccessary.

And it would be nice if we could select the parameters which will be exported
so that only the neccessary settings will be included into the <rendersetting>
tag. (otherwise we always would have to change ALL the settings)

User avatar
OnoSendai
Developer
Posts: 6237
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Fri Jan 26, 2007 1:51 pm

Wedge wrote:Will do Nick. I have a new version of the blender exporter ready to put up in a few hours I will strip those render_settings out of the gui and make the necessary changes.

I will have a look also at the camera settings.

Thanks for the guidelines!

Update: I know its a few days after I posted so I don't know how long it will take to notice this but is there any other options that should be removed from the exporter?

In the blender exporter it has, metropolis, bidirectional, russian_roulette_live_prob, max_num_consec_rejections, and strata width.

Should they be in the exporter as available overrides? Or should they only be in the inifile you made so that advanced users can override but new users don't need to see and therefore not have to worry about?

I personally only have changed bidir on and off, as well as tried playing with the max_num_consec_rejections option back when the thread in the forums was talking about fireflies not going away from an image. Maybe only these two options should be left in the blender exporter gui? Or maybe all of the ones listed above should be left as they are? Or should they all be removed so you can control them from the inifile?

I know these settings are missing from your above post so I thought it would be best to ask.
russian_roulette_live_prob and strata width aren't used by indigo anymore.

Wedge
Posts: 441
Joined: Sun Jan 14, 2007 11:33 am
Location: East Coast, USA

Post by Wedge » Fri Jan 26, 2007 10:17 pm

Ok thanks, I removed them from the 07 exporter. (blender)
Content contained in my posts is for informational purposes only and is used at your own risk.

User avatar
OnoSendai
Developer
Posts: 6237
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Thu Feb 22, 2007 10:53 pm

Added diagram of camera model and formula for calculating angle of view.

j_07
Posts: 23
Joined: Thu Feb 15, 2007 1:45 am

Post by j_07 » Thu Feb 22, 2007 11:53 pm

OnoSendai wrote:Added diagram of camera model and formula for calculating angle of view.
Great! Thanks for that! :D

Jan
Posts: 19
Joined: Sun Jul 02, 2006 10:21 pm

Post by Jan » Fri Feb 23, 2007 1:46 am

Many thanks for explain this. I's more easy than I thought

Alejandro

Post Reply
64 posts

Who is online

Users browsing this forum: No registered users and 2 guests