Page 1 of 11

Indigo 1.0.4

Posted: Wed Nov 28, 2007 5:08 am
by OnoSendai
http://www.indigorenderer.com/joomla/in ... &Itemid=62

changelog:
1.0.4
* added some more checks for XML parsing.
* changed texturing code a bit (faster)
* added aperture_diffraction toggle in infile.
* added aperture_shape camera XML element
* added obstacle_map camera XML element
* fixed error handling when parsing camera response functions.


The main new thing in v1.0.4 is new aperture code, and the related aperture diffraction code.

Aperture shape

The camera XML element now takes an element called 'aperture_shape', that defines the shape of the camera aperture.

The first type of aperture shape is the circular (disc) aperture. If the aperture_shape element is missing, this is assumed as the default.

Code: Select all

<aperture_shape>
		  <circular></circular>
</aperture_shape>
The second type of aperture shape specification generates an aperture visibility map using some diaphragm blade drawing code.

Code: Select all

 <aperture_shape>
		  <generated>
			  <num_blades>6</num_blades>
			  <blade_offset>0.4</blade_offset>
			  <blade_curvature_radius>3.0</blade_curvature_radius>
			  <start_angle>0.2</start_angle>
		  </generated>
</aperture_shape>

The third type of aperture shape just reads a .png image from disk to use as the aperture visibility map. White = light can pass thru, black = blocked.
the image must be square, power of 2 width and height, and be at least 512*512.
The path is absolute or relative to scene file dir.

Code: Select all

<aperture_shape>
		  <image>
			<path>indigo_aperture.png</path>
		  </image>
	  </aperture_shape>
EDIT:
The final aperture size is determined by two factors - the shape defined by the aperture_shape element, and the aperture_radius camera parameter.
In effect, the overall aperture size is multiplied by aperture_radius.

Aperture_radius should really be called 'aperture half width', because it affects the overall scale of the square aperture visibility map.

When creating an aperture map, try and make the white area as similar in area to a disc touching the edges as possible. This will mean that the overall image intensity won't change too much when changing aperture shapes. Use the aperture_radius camera parameter as before, to let more or less light in.


Aperture diffraction

When light (or any wave) passes through a small gap, such as a camera aperture, it spreads out or 'diffracts'. The pattern in which it spreads out depends on factors such as the shape of the aperture and the wavelength of the light. This is a fundamental physical effect which gives a limit on the resolution of optical devices that use apertures (cameras, telescopes etc..)
Such diffraction is also responsible for the glare around bright light sources in photos. Depending on the shape and symmetries of the aperture, different patterns of glare will be apparent.

The new glare stuff in Indigo is based on the paper 'Glare Generation Based on Wave Optics' http://nis-lab.is.s.u-tokyo.ac.jp/nis/abs_cgi.html
which points out that such a diffraction pattern can be calculated using the 2d Fourier transform of the aperture map.

Aperture diffraction is simulated by perturbing rays as they pass through the camera aperture, thanks to Robin Davies for articulating this idea.

An alternative implementation of physically-based diffraction glare could convolve the frame buffer with the diffraction filter as a post-process; I have implemented this, but I currently prefer the non-post-process technique, because you don't have to wait for the convolution, and the results are more realistic because full spectral sampling can be used, whereas a post-process has to work on a 3-component image buffer.

To enable aperture diffraction, set
"aperture_diffraction" "true"
in the inifile.
There is something like a 10% performance penalty (depending on scene) for enabling diffraction, as some non-trivial code has to be executed for each light path.

As per the paper 'Glare Generation Based on Wave Optics', you can specify an (optional) obstacle map in the camera XML. The obstacle map will affect the diffraction pattern.
Use like this:

Code: Select all

<obstacle_map>
		  <path>diag_obstacle.png</path>
</obstacle_map>
The image must be square, power of 2 width and height, and be at least 512*512.
The path is absolute or relative to scene file dir.

When Indigo executes, it will save a couple of files to the indigo dir: aperture_preview.png and diffraction_preview.png, which help you to get an idea of the shape of the aperture and of the diffraction pattern.

Attached are a couple of demonstration images.
The airy_disc image demonstrates diffraction from a circular aperture for monochromatic light.
If you do the maths for the pixel radius of the first Airy disc zero, based on the camera geometry, it should come out as 8.47 pixels, which you can confirm in the image.
See airy_disc_test.igs.

The second image demonstates diffraction from a curved hexagonal aperture, with a regular obstacle map.
See diffraction_test.igs.


Phew, think that about sums it up :)

Posted: Wed Nov 28, 2007 5:10 am
by alexmeyer
FIRST!!!

Juvenile, I know... whatever.

Thanks ono! :wink:

Posted: Wed Nov 28, 2007 5:11 am
by psor
Wow, awesome! Thanks a lot Sir! ;o))


take care
psor

Posted: Wed Nov 28, 2007 5:19 am
by dougal2
OMG :shock:

another level of realism. Will test later... (and possibly have to restart my fibre optic experiments grrr).

Posted: Wed Nov 28, 2007 5:27 am
by cpfresh
Awesome, thank you Ono! :D

Posted: Wed Nov 28, 2007 5:39 am
by Kosmokrator
THANX THANX THANX!!!!!

AN OTHER GREAT RELEASE....... :wink:
before some hours a request become true with this release....
u r in our minds!!!
how far can u bring indigo Nick?(retoric question)

Posted: Wed Nov 28, 2007 5:44 am
by SmartDen
Wow :shock:
Can't await to implement it in blendigo :)
GREAT WORK, NICK!

Posted: Wed Nov 28, 2007 5:56 am
by dougal2
..and already implemented in MayaToIndigo

Nick, can you give us some sensible limits for the values in <generated> please ?

Posted: Wed Nov 28, 2007 6:13 am
by OnoSendai
Added a diagram of how generated_aperture works.

Posted: Wed Nov 28, 2007 6:23 am
by manitwo
wohooo :D thanks!

Posted: Wed Nov 28, 2007 6:33 am
by BbB
Danke schoen!

Posted: Wed Nov 28, 2007 6:36 am
by ortega
woah!!!!!! Nice effect :D

thx mr Ono!

ps: Where the render? (about bedroon) 8)

Posted: Wed Nov 28, 2007 7:31 am
by Camox
Thank you Nick ! :D

Posted: Wed Nov 28, 2007 8:09 am
by metapixel
:D :D :D
Thank!
:D :D :D

Posted: Wed Nov 28, 2007 8:26 am
by paulo_gomes
Thanks Ono!