Ejemplo n.º 1
0
def drawScene(ri, zpos=0, yoffset=0):

    ri.AttributeBegin()
    ri.Attribute('identifier', {'name': 'torus'})
    ri.TransformBegin()
    ri.Translate(-1.7, 0.5 + yoffset, zpos + 0.1)
    ri.Rotate(45, 0, 1, 0)
    ri.Scale(0.2, 0.2, 0.2)
    ri.Torus(1.00, 0.5, 0, 360, 360)
    ri.TransformEnd()
    ri.AttributeEnd()

    ri.AttributeBegin()
    ri.Attribute('identifier', {'name': 'teapot'})
    ri.TransformBegin()
    ri.Translate(-1, yoffset, zpos)
    ri.Rotate(-90, 1, 0, 0)
    ri.Scale(0.15, 0.15, 0.15)
    ri.Geometry('teapot')
    ri.TransformEnd()
    ri.AttributeEnd()

    ri.AttributeBegin()
    ri.Attribute('identifier', {'name': 'sphere'})
    ri.TransformBegin()
    ri.Translate(0, 0.3 + yoffset, zpos)
    ri.Sphere(0.3, -1, 1, 360)
    ri.TransformEnd()
    ri.AttributeEnd()

    ri.AttributeBegin()
    ri.Attribute('identifier', {'name': 'cube'})
    drawCube(ri,
             x=1.0,
             y=0.25 + yoffset,
             z=zpos,
             ry=45.0,
             sx=0.5,
             sy=0.5,
             sz=0.5)
    ri.AttributeEnd()

    ri.AttributeBegin()
    ri.TransformBegin()
    ri.Attribute('identifier', {'name': 'disk'})
    ri.Translate(1.8, 0.5 + yoffset, zpos)
    ri.Scale(0.4, 0.4, 0.4)
    ri.Disk(0, 1, 360)
    ri.TransformEnd()
    ri.AttributeEnd()
Ejemplo n.º 2
0
    'color C1': [0.0, 1.0, 0.0],
    'color C2': [1.0, 0.0, 0.0],
    'float repeat': [3]
})

ri.Displace(
    'PxrDisplace', 'displace1', {
        'uniform float dispAmount': [0.02],
        'reference float dispScalar': ['tileShader:resultF']
    })

# first teapot
ri.AttributeBegin()
# the colour from the shader is driven by noise, metallic by the noise green channel via the noiseToFloat

drawCube(ri, x=-1, y=0.5, ry=-45, sx=0.5, sy=0.5, sz=0.5)
ri.AttributeEnd()

# second teapot
ri.Bxdf('PxrDisney', 'bxdf',
        {'reference color baseColor': ['tileShader:resultRGB']})
drawCube(ri, y=0.5, ry=-45, sx=0.5, sy=0.5, sz=0.5)

# third teapot
ri.Bxdf('PxrDisney', 'bxdf',
        {'reference color baseColor': ['tileShader:resultRGB']})

drawTeapot(ri, x=1, ry=-45)
# floor
ri.TransformBegin()
ri.Pattern(
Ejemplo n.º 3
0
	ri.Attribute ("trace" ,{"int displacements" : [ 1 ]})
	ri.Attribute ("displacementbound", {"float sphere" : [30], "string coordinatesystem" : ["shader"]})
	ri.Bxdf( 'PxrDisney','bxdf', {'reference color baseColor' : ['tileShader:resultRGB']  })
	ri.Pattern('tile','tileShader', { 'color C1'  : [0.0 ,1.0,0.0],
                                  'color C2'  : [1.0 ,0.0,0.0],
                                  'float repeat' : [3]})

	ri.Displace('PxrDisplace', 'displace1' ,{'uniform float dispAmount' : [0.02], 'reference float dispScalar' : ['tileShader:resultF']})


	# first teapot
	ri.AttributeBegin()
	# the colour from the shader is driven by noise, metallic by the noise green channel via the noiseToFloat 


	drawCube(ri,x=-1,y=0.5,ry=-frame,sx=0.5,sy=0.5,sz=0.5)
	ri.AttributeEnd()
	ri.Pattern("tile","tileShader", {"color C1"  : [0.0 ,1.0,0.0],
																	"color C2"  : [1.0 ,0.0,0.0],
																	"float repeat" : [3]})
	# second teapot

	drawCube(ri,y=0.5,rx=frame,ry=-45,sx=0.5,sy=0.5,sz=0.5)

	# third teapot

	drawTeapot(ri,x=1,ry=frame)
	# floor
	ri.TransformBegin()
	ri.Pattern("tile","tileShader", {"color C1"  : [1.0 ,1.0,1.0],
																	 "color C2"  : [1.0 ,0.0,0.0],