Esempio n. 1
0
# CAMERA
rgb = RGBPipeline2D(display_unsaturated_fraction=0.96, name="sRGB")
sampler = RGBAdaptiveSampler2D(rgb,
                               ratio=10,
                               fraction=0.2,
                               min_samples=2000,
                               cutoff=0.01)
camera = PinholeCamera((1024, 1024),
                       parent=world,
                       transform=translate(0, 0.16, -0.4) * rotate(0, -12, 0),
                       pipelines=[rgb],
                       frame_sampler=sampler)
camera.spectral_rays = 15
camera.spectral_bins = 15
camera.pixel_samples = 250
camera.ray_max_depth = 500
camera.ray_extinction_min_depth = 3
camera.ray_extinction_prob = 0.01

# RAY TRACE
ion()
name = 'standford_bunny'
timestamp = time.strftime("%Y-%m-%d_%H-%M-%S")
render_pass = 1
while not camera.render_complete:

    print("Rendering pass {}...".format(render_pass))
    camera.observe()
    rgb.save("{}_{}_pass_{}.png".format(name, timestamp, render_pass))
    print()
Esempio n. 2
0
# ---------------

# Process the ray-traced spectra with the RGB pipeline.
rgb = RGBPipeline2D()

# camera
camera = PinholeCamera((512, 512), pipelines=[rgb], transform=translate(0, 10, -10) * rotate(0, -45, 0))

# camera - pixel sampling settings
camera.fov = 45
camera.pixel_samples = 250

# camera - ray sampling settings
camera.spectral_rays = 1
camera.spectral_bins = 20
camera.ray_max_depth = 100
camera.ray_extinction_prob = 0.1
camera.min_wavelength = 375.0
camera.max_wavelength = 740.0


# 3. Build Scenegraph
# -------------------

world = World()

sphere.parent = world
ground.parent = world
emitter.parent = world
camera.parent = world
Esempio n. 3
0
# background light source
top_light = Sphere(0.5, parent=world, transform=translate(0, 2, -1),
                   material=UniformSurfaceEmitter(d65_white, scale=2))


# Give the prism a high importance to ensure adequate sampling
prism.material.importance = 9

rgb = RGBPipeline2D()

# create and setup the camera
camera = PinholeCamera((512, 256), fov=45, parent=world, pipelines=[rgb])
camera.transform = translate(0, 0.05, -0.05) * rotate(180, -65, 0) * translate(0, 0, -0.75)
camera.ray_importance_sampling = True
camera.ray_important_path_weight = 0.75
camera.ray_max_depth = 500
camera.ray_extinction_prob = 0.01
camera.spectral_bins = 32
camera.spectral_rays = 32
camera.pixel_samples = 100


# start ray tracing
plt.ion()
for p in range(0, 1000):
    print("Rendering pass {}".format(p+1))
    camera.observe()
    rgb.save("prisms_{}.png".format(p+1))
    print()

# display final result