RI Lua Binding Module

This Lua Module provides a RIB (RenderMan Interface Bytestream) outputer following Pixar's RenderMan InterfaceTM Specification (version) 3.2.

Current Version 0.2

This version provides the entire interface binding, allowing you to write RIB output directly from Lua.

The module is written in C++ and has been tested with Lua 5.1.

The module can be downloaded from LuaForge.

A simple example:

-- example:
local grt = require("grt_ri")

-- create a new context
local context,err = grt.newContext("one")
if context == nil then error(err) end

-- grab the RIB interface from the context
local ri = context:getRIBInterface( )
	
ri:Structure( )
ri:Comment("grt:ri module version " .. grt:getVersion( ) ..  ". A simple example." )
ri:Version(3.03)

ri:FrameBegin( 1 )
ri:Format( 400, 300, 1 )
ri:PixelSamples( 4, 4 )	
ri:ShadingInterpolation( "smooth" )
ri:Display( "test.tiff", "file", "rgba" )
ri:Projection( "perspective", "fov", 22)
ri:Exposure( 1.0, 2.2 )

ri:Translate( 0, -0.5, 8 )
ri:Rotate( -40, 1, 0, 0 )
ri:Rotate( -20, 0, 1, 0 ) 

ri:WorldBegin( )	

ri:Comment("Floor")	
ri:AttributeBegin( ) 	
ri:Color( 1, 1, 1 )
ri:Polygon( "P", -5, 0, 5,  5, 0, 5,  5, 0, -5,  -5, 0, -5 )
ri:AttributeEnd( )

local size = 0.1

for i=-1,0,0.2 do
	ri:Comment("A Red Sphere")
	ri:AttributeBegin( )
	ri:Color( size,0,0 )
	ri:Translate( i,0.5,0 )
	ri:Sphere( size,-size,size,360 )
	ri:AttributeEnd( )
	size = size + 0.1
end

ri:WorldEnd( )
ri:FrameEnd( )

-- grab the stream and redirect to stdout
local stream = context:getStream( )
io.write( stream:flush( ) )


	

The RenderMan® Interface Procedures and Protocol are: Copyright 1988, 1989, 2000, Pixar. All Rights Reserved.