Example 6: SAM Trick Hybrid

This example show a hybrid of the previous two examples. The interaction scene contains a surface attribute mesh as well as a ray-served scene.

Here the front two teapots are rendered as a mesh, and the back teapot, the floor and shadows are being rendered by the ray server.

Preparation

There is a prepare.rib containing just two teapots and no floor. This is rendered into a surface attribute mesh as before.

Interacting

This time the interact.rib contains a mix of the two geometry types. The lights and camera are included to enable the system to light the mesh.

Attribute "identifier" "string name" ["ambient"]

LightSource "ambientlight" 1 "intensity" [1] "lightcolor" [0.15 0.15 0.15]

 

Attribute "identifier" "string name" ["light1"]

LightSource "spotlight" 2 "from" [0.402 0.227 -0.702] "to" [0.124 -0.422 0.005]

"intensity" [1] "coneangle" [0.75] "lightcolor" [1 0.9 0.7]

 

Attribute "identifier" "string name" ["light2"]

LightSource "spotlight" 3 "from" [-0.602 0.159 -0.162] "to" [-0.309 -0.751 0.130]

"intensity" [1] "coneangle" [0.7] "lightcolor" [0.4 0.3 0.6]

 

Attribute "identifier" "string name" ["light3"]

LightSource "spotlight" 4 "from" [0.214 -0.0148 1.630] "to" [0.113 -0.234 0.660]

"intensity" [1.6] "coneangle" [0.8] "lightcolor" [0.6 0.0.3 0.0]

 

 

Attribute "identifier" "string name" ["mixer"]

 

Surface "interact.sl"

 

Attribute "identifier" "string name" ["geometry"]

 

Geometry "surface_attribute_mesh" "filename" ["scene.hbsam"]

 

 

Geometry "ray_server" "filename" ["trick.rib"] "raw" [1]

The trick.rib scene also contains the lights, but as long as their identifiers match, they will be treated as a single object during interaction.

Making

As always typing make run in the example directory will process the Makefile to build the mesh and start the application.