Thursday, July 18, 2013

Mitsuba Renderer: Rendering spheres with plastic material and different integrators


In the last tutorial, we looked at a fairly stardard Lambartian/Diffuse material. We will now look at another material type which has specular highlights. This material type is called plastic in Mitsuba. We will render a large checkered plane with three spheres having red, green and blue plastic material so lets get started.

We define our sphere shape as in the first tutorial however the only difference is in the bsdf which has a different color for each sphere. The three spheres are defined as follows:

< !-- Setup blue sphere -- >
< shape type="sphere" >
  < float name="radius" value="0.1"/ >
  < transform name="toWorld" >
    < translate x="0.0" y="0" z="0.0"/ >
  < / transform >
  < bsdf type="plastic" >
    < srgb name="diffuseReflectance" value="#0000ff"/ >
      < float name="intIOR" value="1.9"/ >
  < / bsdf >
< / shape >

< !-- Setup green sphere -- >  
< shape type="sphere" >
  < float name="radius" value="0.1"/ >
  < transform name="toWorld" >
    < translate x="-0.2" y="0" z="0"/ >
  < / transform >
  < bsdf type="plastic" >
    < srgb name="diffuseReflectance" value="#00ff00"/ >
    < float name="intIOR" value="1.9"/ >
  < / bsdf >
< / shape >

< !-- Setup red sphere -- >
< shape type="sphere" >
  < float name="radius" value="0.1"/ >
  < transform name="toWorld" >
    < translate x="0.2" y="0" z="0"/ >
  < / transform >
  < bsdf type="plastic" >
    < srgb name="diffuseReflectance" value="#ff0000"/ >
    < float name="intIOR" value="1.9"/ >
  < / bsdf >
< / shape >

Lets look at one of the sphere's brdf properties in detail. The type for the bsdf in this case is plastic. The diffuseReflectance is the color of the material. If you look at Mitsuba documentation, this property is defined as a spectrum type. There are many ways to define a spectrum. We define it here as a hexadecimal srgb value. We could also define colors in rgb space (for e.g. blue with value="0.0,0.0,1.0") which would give the same output. The last parameter is the interior index of refraction. The rest of the scene elements are the same as in the previous checkered plane tutorial.

One neat feature of the Mistuba front end mtsgui is that it allows us to change the integrator type in real-time using the render settings options (the gear icon in the GUI) as shown below.

Render settings in mtsgui
There are 14 integrators to choose from. I have rendered current scene in all of the available integrators and the output results and timings are written for each integrator in the image caption. Note that these timings were calculated on my laptop with an AMD Radeon (TM) HD 6630M GPU hardware and these will likely differ on your machine. For some of the integrators like adjoint path tracer, path space MLT, progressive photon mapping and stochastic photon mapping, the scene could not converge. Here are all of the rendering for reference.

Adjoint path tracer [3.5970 secs @ 640x480]
Bidirectional path tracing [22.8360 secs @ 640x480]

Ambient occlusion [2.2860 secs @ 640x480]

Energy redistribution path tracing [1.5050 m @ 640x480]
Direct illumination [4.5020 secs @ 640x480]
Path space MLT [N/A @ 640x480]
Path tracing [5.6050 secs @ 640x480]
Photon mapping [1.1671 m @ 640x480]
Primary space MLT [37.7090 secs @ 640x480]

Progressive photon mapping [>6.1809 m @ 640x480]
Stochastic progressive photon mapping [>1.1635 m @ 640x480]
Volume path tracing (simple) [5.2190 secs @ 640x480]
Volume path tracing (extended) [5.9080 secs @ 640x480]

Virtual point light [0.598 secs @ 640x480]
The full scene XML file may be downloaded from here: https://www.dropbox.com/s/d7z5rpc5sgwmcpe/checkeredPlaneRGB_spheres.xml 
You should play around with different render settings and integrators to see their effect on the rendering output. 

0 comments:

Popular Posts

Copyright (C) 2011 - Movania Muhammad Mobeen. Awesome Inc. theme. Powered by Blogger.