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](http://www.indigorenderer.com/montecarlo/indigocamera.png)
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)
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.