fresnel¶
Overview
fresnel.Device |
Hardware device to use for ray tracing. |
fresnel.Scene |
Content of the scene to ray trace. |
Details
The fresnel ray tracing package.
-
fresnel.
__version__
¶ str – Fresnel version
-
class
fresnel.
Device
(mode='auto', n=None)¶ Hardware device to use for ray tracing.
Parameters: Device
defines hardware device to use for ray tracing.Scene
andtracer
instances must be attached to aDevice
. You may attach any number of scenes and tracers to a singleDevice
.When mode is auto, the default,
Device
GPU rendering and fall back on CPU rendering if there is no GPU available or GPU support was not compiled in. Set mode to gpu or cpu to 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 the
available_gpus
list.Tip
Use only a single
Device
to reduce memory consumption.The static member
available_modes
lists 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 thegpu
mode to be available.>>> fresnel.Device.available_modes ['gpu', 'cpu', 'auto']
-
available_modes
¶ list – List of the available execution modes (static member).
-
available_gpus
¶ list – List of the available gpus (static member).
-
mode
¶ string – The active mode
-
-
class
fresnel.
Scene
(device=None, camera='auto', lights=[<fresnel.light.Light object>, <fresnel.light.Light object>])¶ Content of the scene to ray trace.
Parameters: device ( Device
) – Device to create this Scene on.Scene
defines the contents of the scene to be ray traced, including any number ofgeometry
objects, thecamera
,background color
,background alpha
, and thelights
.Every
Scene
attaches to aDevice
. For convenience,Scene
creates a defaultDevice
when device is None. If you want a non-default device, you must create it explicitly.Lights
lights
is a sequence of up to 4 directional lights that apply to the scene globally. Each light has a direction and color. You can assign lights using one of the predefined setups:scene.lights = fresnel.light.butterfly()
You can assign a sequence of
Light
objects:scene.lights = [fresnel.light.Light(direction=(1,2,3))]
You can modify the lights in place:
>>> print(len(scene.lights)) 2 >>> l.append(fresnel.light.Light(direction=(1,0,0), color=(1,1,1))) >>> print(len(3)) 1 >>> print(l[2]).direction (1,0,0) >>> l[0].direction = (-1,0,0) >>> print(l[0]).direction (-1,0,0)
-
camera
¶ camera.Camera
– Camera view parameters, or ‘auto’ to automatically choose a camera.
-
background_color
¶ tuple[float] – Background color (r,g,b) as a tuple or other 3-length python object, in the linearized color space. Use
fresnel.color.linear()
to convert standard sRGB colors
-
background_alpha
¶ float – Background alpha (opacity).
-
lights
¶ list of light.Light – Globals lights in the scene.
-
get_extents
()¶ Get the extents of the scene
Returns: - [[minimum x, minimum y, minimum z],
- [maximum x, maximum y, maximum z]]
-
-
fresnel.
pathtrace
(scene, w=600, h=370, samples=64, light_samples=1)¶ Path trace a scene.
Parameters: pathtrace()
is a shortcut to rendering output with thePath
tracer. See thePath
tracer for a complete description.
-
fresnel.
preview
(scene, w=600, h=370, aa_level=0)¶ Preview a scene.
Parameters: preview()
is a shortcut to rendering output with thePreview
tracer. See thePreview
tracer for a complete description.
Modules