max_wavelength=max_wl, spectral_bins=1, pixel_samples=samples, parent=world, transform=rotate(0, 0, 0) * translate(0, 0, -cube_size / 2)) # Emitter is a sphere volume emitter located at the origin # Volume of the sphere is 4/3 * Pi * r^3, emission over 4 * pi # UnityVolumeEmitter emits 1W/str/m^3/ x nm, where x is the wavelength interval, integrated over length print("Starting observations with volume emitter...") calculated_volume_emission = 16 / 3 * pi**2 * sphere_radius**3 * (max_wl - min_wl) emitter.material = UnityVolumeEmitter() observing_plane.observe() measured_volume_emission = 6 * power.value.mean measured_volume_error = 6 * power.value.error() # Emitter is a sphere surface emitter located at the origin # Surface area of the sphere is 4 * Pi * r^2, lambert emitter # UniformSurfaceEmitter is configured to emit 1W/str/m^2/ x nm, where x is the wavelength interval print("Starting observations with surface emitter...") calculated_surface_emission = 4 * pi**2 * sphere_radius**2 * (max_wl - min_wl) emitter.material = UniformSurfaceEmitter(ConstantSF(1.0)) observing_plane.observe() measured_surface_emission = 6 * power.value.mean measured_surface_error = 6 * power.value.error()
base_path = os.path.split(os.path.realpath(__file__))[0] mesh = import_obj(os.path.join(base_path, "../resources/box_normals_inwards.obj"), scaling=2.0) power = PowerPipeline0D(accumulate=False) observer = MeshPixel(mesh, pipelines=[power], parent=world, min_wavelength=min_wl, max_wavelength=max_wl, spectral_bins=1, pixel_samples=samples) # Emitter is a sphere volume emitter located at the origin # Volume of the sphere is 4/3 * Pi * r^3, emission over 4 * pi # UnityVolumeEmitter emits 1W/str/m^3/ x nm, where x is the wavelength interval, integrated over length print("Starting observations with volume emitter...") calculated_volume_emission = 16 / 3 * pi**2 * sphere_radius**3 * (max_wl - min_wl) emitter.material = UnityVolumeEmitter() observer.observe() measured_volume_emission = power.value.mean measured_volume_error = power.value.error() # Emitter is a sphere surface emitter located at the origin # Surface area of the sphere is 4 * Pi * r^2, lambert emitter # UniformSurfaceEmitter is configured to emit 1W/str/m^2/ x nm, where x is the wavelength interval print("Starting observations with surface emitter...") calculated_surface_emission = 4 * pi**2 * sphere_radius**2 * (max_wl - min_wl) emitter.material = UniformSurfaceEmitter(ConstantSF(1.0)) observer.observe() measured_surface_emission = power.value.mean measured_surface_error = power.value.error()
power = PowerPipeline0D(accumulate=False) observer = MeshPixel(mesh, pipelines=[power], parent=world, min_wavelength=min_wl, max_wavelength=max_wl, spectral_bins=1, pixel_samples=samples, surface_offset=1E-6) print("Starting observations with volume emitter...") calculated_volume_emission = 16 / 3 * pi**2 * sphere_radius**3 * (max_wl - min_wl) emitter.material = UnityVolumeEmitter() observer.observe() measured_volume_emission = power.value.mean measured_volume_error = power.value.error() print() print('Expected volume emission => {} W'.format(calculated_volume_emission)) print('Measured volume emission => {} +/- {} W'.format( measured_volume_emission, measured_volume_error)) power = PowerPipeline1D() sampler = MonoAdaptiveSampler1D(power, fraction=0.2, ratio=25.0, min_samples=1000, cutoff=0.1)
base_path = os.path.split(os.path.realpath(__file__))[0] mesh = import_obj(os.path.join(base_path, "../resources/stanford_bunny.obj"), material=AbsorbingSurface(), parent=world, flip_normals=True) power = PowerPipeline0D(accumulate=False) observer = MeshPixel(mesh, pipelines=[power], parent=world, min_wavelength=min_wl, max_wavelength=max_wl, spectral_bins=1, pixel_samples=samples, surface_offset=1E-6) print("Starting observations with volume emitter...") calculated_volume_emission = 16 / 3 * pi**2 * sphere_radius**3 * (max_wl - min_wl) emitter.material = UnityVolumeEmitter() observer.observe() measured_volume_emission = power.value.mean measured_volume_error = power.value.error() print() print('Expected volume emission => {} W'.format(calculated_volume_emission)) print('Measured volume emission => {} +/- {} W'.format(measured_volume_emission, measured_volume_error)) power = PowerPipeline1D() sampler = MonoAdaptiveSampler1D(power, fraction=0.2, ratio=25.0, min_samples=1000, cutoff=0.1) camera = MeshCamera( mesh, surface_offset=1e-6, # launch rays 1mm off surface to avoid intersection with absorbing mesh pipelines=[power],