Skip to content

ExamplesProceduralsSubdivisonSurfaceRender

Ben Toogood edited this page Jun 13, 2013 · 2 revisions

Subdivision Surface Render

This cookbook example demonstrates how to load & render a mesh primitive and render it as a subdivision surface by setting the mesh primitive interpolation to "catmullClark".

320px-Cookbook_subdRenderGL.jpg opengl

320px-Cookbook_subdRenderRI.jpg renderman

Code

from IECore import *

class subdRender(ParameterisedProcedural) :

	def __init__(self) :
		ParameterisedProcedural.__init__( self, "Renders a mesh as a subd." )
		path = PathParameter( "path", "Path", "" )
		self.parameters().addParameter( path )

	def doBound(self, args) :
		geo = Reader.create( args['path'].value ).read()
		return geo.bound()

	def doRenderState(self, renderer, args) :
		pass

	def doRender(self, renderer, args) :
		geo = Reader.create( args['path'].value ).read()
		geo.interpolation = "catmullClark"
		geo.render( renderer )

registerRunTimeTyped( subdRender )
Clone this wiki locally