fresnel¶
Overview
Hardware device to use for ray tracing. |
|
Path trace a scene. |
|
Preview a scene. |
|
Content of the scene to ray trace. |
Details
The fresnel ray tracing package.
- class fresnel.Device(mode='auto', n=None)¶
Hardware device to use for ray tracing.
- Parameters:
Devicedefines hardware device to use for ray tracing.SceneandTracerinstances must be attached to aDevice. You may attach any number of scenes and tracers to a singleDevice.When mode is
auto, the default,Devicewill select GPU rendering if available and fall back on CPU rendering if not. Set mode togpuorcputo force a specific mode.Important
By default (
n==None), this device will use all available GPUs or CPU cores. Set n to the number of GPUs or CPU cores this device should use. When selecting n GPUs, the device selects the first n in theavailable_gpuslist.Tip
Use only a single
Deviceto reduce memory consumption.The static member
available_modeslists which modes are available. For a mode to be available, the corresponding module must be enabled at compile time. Additionally, there must be at least one GPU present for thegpumode to be available.>>> fresnel.Device.available_modes ['gpu', 'cpu', 'auto']
- class fresnel.Scene(device=None, camera=None, lights=None)¶
Content of the scene to ray trace.
- Parameters:
device (Device) – Device to use when rendering the scene.
camera (camera.Camera) –
Camera to view the scene. When
None, defaults to:camera.Orthographic( position=(0, 0, 100), look_at=(0, 0, 0), up=(0, 1, 0), height=100, )
lights (list[Light]) – Lights to light the scene. When
None, defaults to:light.rembrandt()
Scenedefines the contents of the scene to be traced, including any number ofGeometryobjects, theCamera, thebackground_color,background_alpha, andlights.Every
Scenemust be associated with aDevice. For convenience,Scenecreates a defaultDevicewhen device isNone.- property background_color¶
Background color linear RGB.
Note
Use
fresnel.color.linearto convert standard sRGB colors into the linear color space used by fresnel.- Type:
((3, )
numpy.ndarrayofnumpy.float32)
- property camera¶
Camera view parameters.
- Type:
- get_extents()¶
Get the extents of the scene.
- Returns:
The lower left and upper right corners of the scene.
- Return type:
(3,2)
numpy.ndarrayofnumpy.float32
- fresnel.pathtrace(scene, w=600, h=370, samples=64, light_samples=1)¶
Path trace a scene.
- Parameters:
pathtrace()is a shortcut that renders output withtracer.Path.
- fresnel.preview(scene, w=600, h=370, anti_alias=True)¶
Preview a scene.
- Parameters:
preview()is a shortcut that renders output withtracer.Preview.
Modules