Example #1
0
from scenes.default_scenes import BoxScene
from objects import *
#from shader import SpectrumShader

#scene = BoxScene(SpectrumShader)
scene = BoxScene()

for obj in scene.get_objects('wall'): obj.material = 'red'
scene.get_object('floor').material = 'white'
scene.get_object('ceiling').material = 'green'
#scene.get_object('light').material = 'white'
scene.get_object('light').bidirectional_light = True
scene.materials['black'] = { 'diffuse': 0.2 }
scene.materials['light']['diffuse'] = 0.0
scene.add_object( HalfSpace( (-1,-1,-2), 5 ), 'sky' )

obj = Sphere((0,0,0.6), 0.3)
obj.linear_transform(scaling=(1,1,2))
scene.add_object( obj, 'mirror' )

szmul = 120
scene.image_size = (8*szmul,6*szmul)

scene.samples_per_pixel = 15000
scene.camera_position = (-2,-3,1)
scene.direct_camera_towards((0,0,0.6))
scene.camera_fov = 50

scene.min_bounces = 2
scene.max_bounces = 5
from objects import *
from utils import vec_norm
from scenes.default_scenes import BoxScene
import numpy as np

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')
Example #3
0
    lambda p, R: Octahedron( p, R*0.5 ),
    # 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)