scene = BoxScene() scene.materials['floor'] = { 'diffuse': 0.1, 'reflection': 0.15, 'reflection_blur': 0.05 } scene.materials['glass']['transparency'] = (0.4, 0.6, 0.9) scene.materials['glass']['ior'] = 1.5 scene.materials['wax']['volume_absorption'] = (1.0 - np.array((0.2,0.8,0.4)))*7.0 scene.materials['wax']['diffuse'] = (0.02,0.03,0.04) scene.materials['wax']['reflection'] = (0.01,0.04,0.02) scene.get_object('floor').material = 'floor' scene.get_object('ceiling').material = 'white' scene.get_object('light').bidirectional_light = True for obj in scene.get_objects('wall'): obj.material = 'white' #scene.materials['default']['volume_scattering'] = 0.15 #scene.materials['default']['volume_scattering_blur'] = 0.03 scene.add_object(HalfSpace( (-1,-1,-2), 5 ), 'sky') scene.add_object( ConvexIntersection( (-0.2,2.5,1.0), [ CylinderComponent( (1,1,0), 1, ), CylinderComponent( (0,1,0), 1, ), CylinderComponent( (1,0,1), 1, )
# another ConvexIntersection, should have different tracer lambda p, R: ConvexIntersection( p, [ \ CylinderComponent( (1,1,0), R, ), \ SphereComponent( (0,0,0), R*1.2, ), LayerComponent( (1,0,0), 2.0*R ) ]), # Octree load_triangle_mesh_in_octree, lambda p, R: DistanceField( tracer_code="dist = sqrt(x*x + y*y + z*z) - %g" % R, center=p ) ] test_materials = [ 'white', 'mirror', 'glass', 'wax' ] scene = BoxScene() scene.get_object('light').bidirectional_light = True grid_side = int(math.ceil(math.sqrt(len(test_objects)))) grid = [(x,y) for x in range(grid_side) for y in range(grid_side)] grid_size = 4.0 scale = 0.5*grid_size/grid_side index_to_coord = lambda ix: ((ix+0.5)/float(grid_side)-0.5)*grid_size for i in range(len(test_objects)): ix, iy = grid[i] material = test_materials[i % len(test_materials)] obj_scale = 0.5 z = scale*obj_scale x = index_to_coord(ix) y = index_to_coord(iy) pos = numpy.array((x,y,z))