Gelato Renderer Exercise

From Kwicky

Jump to: navigation, search

Contents

[edit] Overview

[edit] Introduction

Gelato is available in two versions. First is the free version and the other is the PRO version costing $1500. There are no limitations to the free version and it can even be used for commercial purposes by companies.

[edit] Renderer style

Gelato is a hardware accelerated non-realtime renderer from NVIDIA Corp. It uses NVIDIA GPUs for rendering scenes. Unlike the usual rendering process done by regular GPUs (while playing games) where there is a trade-off between speed (frames-per-second) and the quality of the render; Gelato being an offline renderer is made to never compromise on the quality of the render. It always trades time for a better quality render. Another main difference is Gelato exploits the float-point processor on GPU for general purpose CPU computation tasks required during the rendering process. This helps Gelato render scenes faster than the software rendering packages.

Usual GPUs use scan converting techniques to render as they are faster than ray-tracing techniques. Since Gelato does not have any constraints on time, it supports both scan-conversion and ray tracing. In addition it also has support for caustics, volumetric shadows, global illumination, ambient occlusion etc. It includes support for a large number of geometric models including NURBS, bilinear and bicubic patches, subdivision surfaces, particles, curves etc.

[edit] Interface

Using Autodesk Maya software (through Mango plugin) is the preferred and recommended way of interfacing with Gelato. Also, programs can be written using the C++ API of Gelato. Other methods include Amaretto plugin for 3ds Max, a python based scene description language and a freeware to support RIB (Renderman) scene files. Examples of using Gelato are provided just through the Maya software interface. Gelato also has its own shading language called GSL.

[edit] Other

Another important features in Gelato PRO is the Sorbetto Re-Lightening engine. It allows very fast recomputation of changes in lightening. Suppose, we render a scene and then tweak the lights in the scene. Instead of re-rendering the scene, Sorbetto very quickly computes the new lightening on the appropriate pixels. This new scene image is the identical to the image produced if the whole scene was re-rendered. Sorbetto achieves this in the following way. Normally the renderers after they have initially rendered the scene, throw away all the data except the RGB values of a pixel. This helps them in clearing up the memory. Sorbetto doesnot throw away this data and uses it to re-compute the changes in the lightening of the scene. This leads to a bigger memory requirement but has the speed advantage.

[edit] Examples

I rendered two examples that came with Gelato in examples/ folder.

Image:Gelato_ambient_copy.jpg
Ambient Occlusion [ 9 secs]

Image:Gelato_caustic_copy.jpg
Caustic Surfaces
Photon propogation: 6 sec
View reconstruction: 7 sec

[edit] Scene

And here is my scene render. I could not find Maya 8.5 to run Gelato with, so I hand-coded the "python graphics" file that Gelato renders.
Normally you would use Gelato in this way:
Autodesk Maya (Gelato plugin) > .pyg file (autogenerated) > Gelato

In absense of Maya, I wrote my whole scene description in the .pyg file . Also I tried to use as many features of Gelato that were not shown in the examples files that come with Gelato. Image:Final_hw_big_copy.jpg

The example shows:

  • Indirect Lightning
  • Ray traced shadows
  • Reflection (notice the reflection of red teapot on the yellow one)
  • Transparency and refraction
  • Texture mapping (note the red teapot and the floor)
  • Shaders

Rendering time: 2 minutes

Download

[edit] Experience

Here is the interesting part. Tutorials on the Gelato website only focus on using Maya for Gelato. I tried that approach first. Unfortunately I could not get my hands on a copy of Maya 8.5. I tried it with Maya 8.5 PLE (Personal Learning Edition - free) and also with Maya 2008 (newest, on a friend's computer). But it didnt work on either of these.

Then I started looking at example pyg files in examples/ folder and started to reverse engineer them. There is no documentation for their python (.pyg) API. Then I found a C++ API reference and correlated its functions to the python functions and that is how I made it work.

I ended up create a quite satisfactory render; the complete scene was hand-coded in python.

That aside, I believe that the Gelato engine is excellent and has support for a wide spectrum of effects. Highly Recommended.

[edit] Python generator file

# teaparty.pyg
# Gaurav Gupta

# Specify output image file, and default camera "camera"
Output ( "teaparty.tif", "tiff", "rgba", "camera" )

# Set global attributes
Attribute ( "string path:shader", ".:shaders:&" )
Attribute ( "int[2] resolution", (1024, 1024) )
Attribute ( "float shadingquality", 1 )
Attribute ( "string projection", "perspective" )
Attribute ( "float fov", 50 )

# Position the camera
Translate ( 3, -2, 8 )
Rotate(-60,0,1,0)
Translate(5,2,6)
Rotate(30,0,0,1)

# Start scene
World ()

Light("indlight", "indirectlight","string indirectname","indirect")

PushTransform ()

# Position the light
Translate (0,2,-1)

# Set up light
Parameter ( "float intensity", 0.8 )
Light ( "thelight1", "pointlight", "float falloff", 0,"string shadowname","shadow" )

PopTransform ()

# Set surface shader
Shader ( "surface", "matte" )

PushAttributes ()
Shader ( "surface", "matte")
Attribute ( "string name", "Wall" )
Translate ( 0, 0, 5 )
Rotate ( -90, 0, 0, 1 )
Scale(70,70,70)
Attribute("string geometryset","+indirect")
Patch ("linear", 2, 2, "vertex point P", ((-1, -1, 0), (1, -1, 0), (-1, 1, 0), (1, 1, 0)))
PopAttributes ()

PushAttributes ()
Shader ( "surface", "matte")
Attribute ( "string name", "Floor" ,"string shadowname","shadow")
Translate ( 0, -1, 3 )
Rotate ( -90, 1, 0, 0 )
Scale(70,70,70)
Attribute("string geometryset","+indirect")
Patch ("linear", 2, 2, "vertex point P", ((-1, -1, 0), (1, -1, 0), (-1, 1, 0), (1, 1, 0)))
PopAttributes ()

PushTransform ()
Shader ( "surface", "paintedplastic",
	"string texturename", "bgtexture.tx",
	"float Kd", 1.0 )
Attribute ( "color C", (1, 1, 1) )
Translate ( 0, -1, 3 )
Rotate ( -90, 1, 0, 0 )
Scale(20,20,20)
Attribute("string geometryset","+indirect")
Patch ("linear", 2, 2,
	"vertex point P", ( (-1, 1, 0), (1, 1, 0),
	(-1, -1, 0), (1, -1, 0)))
PopTransform ()

PushAttributes ()
ShaderGroupBegin ()
Shader ( "surface", "pretexture", "string texturename", "grid.tx" )
Shader ( "surface", "plastic" )
ShaderGroupEnd ()
Translate ( 0, -1, 3 )
Rotate ( -90, 1, 0, 0 )
Attribute("string geometryset","+indirect")
Attribute("string geometryset","+reflection")
Attribute("string geometryset","+shadow")
Input ("teapot.pyg")
PopAttributes ()

PushAttributes ()
Shader ( "surface", "metal", "float Ks", .2, "float Kd",.1, "float Ka",.3,"float roughness",0.2,"float Kr",0.4,"float blur",0,"string envname","reflection")
Translate ( 5, -1, 0 )
Rotate ( -90, 1, 0, 0 )
Rotate(-45,0,0,1)
Attribute("string geometryset","+indirect")
Attribute("string geometryset","+reflection")
Attribute("string geometryset","+shadow")
Input ("teapotm.pyg")
PopAttributes ()

PushAttributes ()
Shader ( "surface", "fakeglass","float eta",1.5)
Translate ( -2, -1, -3 )
Rotate ( -90, 1, 0, 0 )
Rotate(75,0,0,1)
Attribute("string geometryset","+reflection")
Attribute("color opacity",(.5,.5,.5))
Input ("teapotg.pyg")
PopAttributes ()


# Render the scene
Render ()
Personal tools