Skip to content

Commit 4f68105

Browse files
authored
Merge pull request #322 from raysect/development
Release v0.6.0
2 parents 158500f + 2160241 commit 4f68105

File tree

106 files changed

+4227
-493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+4227
-493
lines changed

.coveragerc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[run]
2+
plugins = Cython.Coverage
3+
source = raysect
4+
omit = *tests*

CHANGELOG.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
Raysect Changelog
22
=================
33

4+
Release 0.6.0 (13 Nov 2019)
5+
---------------------------
6+
7+
API Changes:
8+
* Blend material modifier now blends the surface and volume by default. Use the surface_only and volume_only options to configure.
9+
* Cython minimum, maximum and peak to peak methods can now cope with arbitrary strides.
10+
* Interpolator2DMesh and Discrete2DMesh have import has changed from raysect.core.math.interpolators to raysect.core.math.function.
11+
12+
New:
13+
* Added an Add material modifier than sums the contributions from two materials.
14+
* Added emissivity function to BlackBody.
15+
* Extended Spectrum cython mathematical methods to simplify combining Spectrum objects.
16+
* Expanded the function framework:
17+
- Constants are now autowrapped as ConstantXD objects automatically.
18+
- Added PowXD, ExpXD, SinXD, CosXD, TanXD, AsinXD, AcosXD, AtanXD, Atan4QXD functions.
19+
- Argument pass-through supported with ArgXD functions.
20+
- Interpolation functions moved under raysect.core.math.function.
21+
* Improved the Multicore render engine by batching work to reduce IPC overhead. Renders with smaller amounts of work per pixel are now substantially quicker.
22+
* Improved multiple demos and related documentation.
23+
24+
425
Release 0.5.6 (24 Aug 2019)
526
---------------------------
627

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include README.md CHANGELOG.txt LICENSE.txt CONTRIBUTING.txt AUTHORS.txt MANIFEST.in setup.py .gitignore
22
include raysect/VERSION
3+
global-exclude *.c
34
recursive-include raysect *.py *.pyx *.pxd *.csv *.json
45
recursive-include demos *.py *.pyx *.pxd *.csv *.obj *.rsm
56
recursive-include docs *

demos/cornell_box.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,13 @@
9797
transform=translate(0, 1, 0) * rotate(0, 90, 0),
9898
material=UniformSurfaceEmitter(light_spectrum, 2))
9999

100+
# alternate light #1
100101
# light = Box(Point3D(-0.4, -0.4, -0.01), Point3D(0.4, 0.4, 0.0),
101102
# parent=enclosure,
102103
# transform=translate(0, 1, 0) * rotate(0, 90, 0),
103104
# material=UniformSurfaceEmitter(d65_white, 2))
104105

106+
# alternate light #2
105107
# back_light = Sphere(0.1,
106108
# parent=enclosure,
107109
# transform=translate(0.80, -0.85, 0.80)*rotate(0, 0, 0),
@@ -140,13 +142,13 @@
140142

141143
pipelines = [rgb, power_unfiltered, power_green, power_red, bayer]
142144

143-
sampler = RGBAdaptiveSampler2D(rgb, ratio=10, fraction=0.2, min_samples=500, cutoff=0.05)
145+
sampler = RGBAdaptiveSampler2D(rgb, ratio=10, fraction=0.2, min_samples=500, cutoff=0.01)
144146

145-
camera = PinholeCamera((512, 512), parent=world, transform=translate(0, 0, -3.3) * rotate(0, 0, 0), pipelines=pipelines)
147+
camera = PinholeCamera((1024, 1024), parent=world, transform=translate(0, 0, -3.3) * rotate(0, 0, 0), pipelines=pipelines)
146148
camera.frame_sampler = sampler
147-
camera.pixel_samples = 250
148-
camera.spectral_bins = 15
149149
camera.spectral_rays = 1
150+
camera.spectral_bins = 15
151+
camera.pixel_samples = 250
150152
camera.ray_importance_sampling = True
151153
camera.ray_important_path_weight = 0.25
152154
camera.ray_max_depth = 500
@@ -155,21 +157,22 @@
155157

156158
# start ray tracing
157159
ion()
158-
p = 1
160+
name = 'cornell_box'
161+
timestamp = time.strftime("%Y-%m-%d_%H-%M-%S")
162+
render_pass = 1
159163
while not camera.render_complete:
160164

161-
print("Rendering pass {}...".format(p))
162-
165+
print("Rendering pass {}...".format(render_pass))
163166
camera.observe()
164-
165-
rgb.save('cornell_box_rgb_pass_{:04d}.png'.format(p))
166-
power_unfiltered.save('cornell_box_unfiltered_pass_{:04d}.png'.format(p))
167+
rgb.save("{}_{}_pass_{}.png".format(name, timestamp, render_pass))
168+
# power_unfiltered.save('cornell_box_unfiltered_pass_{:04d}.png'.format(p))
167169
# power_red.save('cornell_box_red_filter_pass_{:04d}.png'.format(p))
168170
# power_green.save('cornell_box_green_filter_pass_{:04d}.png'.format(p))
169171
# bayer.save('cornell_box_bayer_pass_{:04d}.png'.format(p))
170-
171172
print()
172-
p += 1
173+
174+
render_pass += 1
173175

174176
ioff()
175177
rgb.display()
178+

demos/materials/bunny.py

Lines changed: 51 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
21
# External imports
32
import os
43
from matplotlib.pyplot import *
54
import time
65

76
# Internal imports
87
from raysect.optical import World, translate, rotate, Point3D, d65_white, ConstantSF, Node
9-
from raysect.optical.observer import PinholeCamera
10-
from raysect.optical.material.dielectric import Sellmeier, Dielectric
8+
from raysect.optical.observer import PinholeCamera, RGBPipeline2D, RGBAdaptiveSampler2D
119
from raysect.optical.material.emitter import UniformVolumeEmitter
1210
from raysect.optical.material import Lambert
1311
from raysect.primitive import Box, Subtract
14-
from raysect.primitive.mesh import Mesh, import_obj
12+
from raysect.primitive.mesh import import_obj
1513
from raysect.optical.library import schott
1614

17-
1815
"""
19-
A Diamond Stanford Bunny on an Illuminated Glass Pedestal
20-
---------------------------------------------------------
16+
A Glass Stanford Bunny on an Illuminated Glass Pedestal
17+
-------------------------------------------------------
2118
2219
Bunny model source:
2320
Stanford University Computer Graphics Laboratory
@@ -33,41 +30,68 @@
3330
mesh = import_obj(os.path.join(base_path, "../resources/stanford_bunny.obj"), parent=world,
3431
transform=translate(0, 0, 0)*rotate(165, 0, 0), material=schott("N-BK7"))
3532

36-
3733
# LIGHT BOX
3834
padding = 1e-5
3935
enclosure_thickness = 0.001 + padding
4036
glass_thickness = 0.003
4137

4238
light_box = Node(parent=world)
4339

44-
enclosure_outer = Box(Point3D(-0.10 - enclosure_thickness, -0.02 - enclosure_thickness, -0.10 - enclosure_thickness),
45-
Point3D(0.10 + enclosure_thickness, 0.0, 0.10 + enclosure_thickness))
46-
enclosure_inner = Box(Point3D(-0.10 - padding, -0.02 - padding, -0.10 - padding),
47-
Point3D(0.10 + padding, 0.001, 0.10 + padding))
40+
enclosure_outer = Box(
41+
Point3D(-0.10 - enclosure_thickness, -0.02 - enclosure_thickness, -0.10 - enclosure_thickness),
42+
Point3D(0.10 + enclosure_thickness, 0.0, 0.10 + enclosure_thickness)
43+
)
44+
45+
enclosure_inner = Box(
46+
Point3D(-0.10 - padding, -0.02 - padding, -0.10 - padding),
47+
Point3D(0.10 + padding, 0.001, 0.10 + padding)
48+
)
49+
4850
enclosure = Subtract(enclosure_outer, enclosure_inner, material=Lambert(ConstantSF(0.2)), parent=light_box)
4951

50-
glass_outer = Box(Point3D(-0.10, -0.02, -0.10),
51-
Point3D(0.10, 0.0, 0.10))
52-
glass_inner = Box(Point3D(-0.10 + glass_thickness, -0.02 + glass_thickness, -0.10 + glass_thickness),
53-
Point3D(0.10 - glass_thickness, 0.0 - glass_thickness, 0.10 - glass_thickness))
52+
glass_outer = Box(
53+
Point3D(-0.10, -0.02, -0.10),
54+
Point3D(0.10, 0.0, 0.10)
55+
)
56+
57+
glass_inner = Box(
58+
Point3D(-0.10 + glass_thickness, -0.02 + glass_thickness, -0.10 + glass_thickness),
59+
Point3D(0.10 - glass_thickness, 0.0 - glass_thickness, 0.10 - glass_thickness)
60+
)
61+
5462
glass = Subtract(glass_outer, glass_inner, material=schott("N-BK7"), parent=light_box)
5563

56-
emitter = Box(Point3D(-0.10 + glass_thickness + padding, -0.02 + glass_thickness + padding, -0.10 + glass_thickness + padding),
57-
Point3D(0.10 - glass_thickness - padding, 0.0 - glass_thickness - padding, 0.10 - glass_thickness - padding),
58-
material=UniformVolumeEmitter(d65_white, 50), parent=light_box)
64+
emitter = Box(
65+
Point3D(-0.10 + glass_thickness + padding, -0.02 + glass_thickness + padding, -0.10 + glass_thickness + padding),
66+
Point3D(0.10 - glass_thickness - padding, 0.0 - glass_thickness - padding, 0.10 - glass_thickness - padding),
67+
material=UniformVolumeEmitter(d65_white, 50),
68+
parent=light_box
69+
)
5970

6071
# CAMERA
61-
ion()
62-
camera = PinholeCamera((256, 256), fov=40, parent=world, transform=translate(0, 0.16, -0.4) * rotate(0, -12, 0))
63-
camera.pixel_samples = 50
72+
rgb = RGBPipeline2D(display_unsaturated_fraction=0.96, name="sRGB")
73+
sampler = RGBAdaptiveSampler2D(rgb, ratio=10, fraction=0.2, min_samples=2000, cutoff=0.01)
74+
camera = PinholeCamera((1024, 1024), parent=world, transform=translate(0, 0.16, -0.4) * rotate(0, -12, 0), pipelines=[rgb], frame_sampler=sampler)
6475
camera.spectral_rays = 15
6576
camera.spectral_bins = 15
66-
camera.observe()
77+
camera.pixel_samples = 250
78+
camera.ray_max_depth = 500
79+
camera.ray_extinction_min_depth = 3
80+
camera.ray_extinction_prob = 0.01
6781

68-
ioff()
69-
rgb = camera.pipelines[0]
70-
rgb.save("stanford_bunny_{}.png".format(time.strftime("%Y-%m-%d_%H-%M-%S")))
82+
# RAY TRACE
83+
ion()
84+
name = 'standford_bunny'
85+
timestamp = time.strftime("%Y-%m-%d_%H-%M-%S")
86+
render_pass = 1
87+
while not camera.render_complete:
88+
89+
print("Rendering pass {}...".format(render_pass))
90+
camera.observe()
91+
rgb.save("{}_{}_pass_{}.png".format(name, timestamp, render_pass))
92+
print()
7193

72-
show()
94+
render_pass += 1
7395

96+
ioff()
97+
rgb.display()

demos/materials/diamond.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
# DIAMOND MATERIAL
14-
diamond_material = Dielectric(Sellmeier(0.3306, 4.3356, 0.0, 0.1750**2, 0.1060**2, 0.0), ConstantSF(1))
14+
diamond_material = Dielectric(Sellmeier(0.3306, 4.3356, 0.0, 0.1750**2, 0.1060**2, 0.0), ConstantSF(0.998))
1515
diamond_material.importance = 2
1616

1717
world = World()
@@ -32,24 +32,30 @@
3232
Sphere(10, world, transform=translate(7, 20, 20), material=UniformSurfaceEmitter(d65_white, 0.15))
3333

3434
# camera
35-
rgb_pipeline = RGBPipeline2D(display_update_time=15, display_unsaturated_fraction=0.998)
36-
sampler = RGBAdaptiveSampler2D(rgb_pipeline, min_samples=400, fraction=0.1)
37-
camera = PinholeCamera((1024, 1024), parent=world, transform=translate(0, 4, -3.5) * rotate(0, -46, 0), pipelines=[rgb_pipeline], frame_sampler=sampler)
38-
camera.spectral_bins = 18
39-
camera.spectral_rays = 9
40-
camera.pixel_samples = 200
41-
35+
rgb = RGBPipeline2D(display_update_time=15, display_unsaturated_fraction=0.995)
36+
sampler = RGBAdaptiveSampler2D(rgb, min_samples=1000, fraction=0.1, cutoff=0.01)
37+
camera = PinholeCamera((1024, 1024), parent=world, transform=translate(0, 4, -3.5) * rotate(0, -46, 0), pipelines=[rgb], frame_sampler=sampler)
38+
camera.spectral_bins = 21
39+
camera.spectral_rays = 21
40+
camera.pixel_samples = 250
41+
camera.ray_max_depth = 10000
42+
camera.ray_extinction_min_depth = 3
43+
camera.ray_extinction_prob = 0.002
4244

4345
# start ray tracing
4446
ion()
47+
name = 'diamond'
4548
timestamp = time.strftime("%Y-%m-%d_%H-%M-%S")
46-
for p in range(1, 1000):
47-
print("Rendering pass {}...".format(p))
49+
render_pass = 1
50+
while not camera.render_complete:
51+
52+
print("Rendering pass {}...".format(render_pass))
4853
camera.observe()
49-
rgb_pipeline.save("demo_diamond_{}_pass_{}.png".format(timestamp, p))
54+
rgb.save("{}_{}_pass_{}.png".format(name, timestamp, render_pass))
5055
print()
5156

52-
# display final result
57+
render_pass += 1
58+
5359
ioff()
54-
rgb_pipeline.display()
55-
show()
60+
rgb.display()
61+

demos/materials/material_roughness_scan.py

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)