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
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
will select GPU rendering if available and fall back on CPU rendering if not. Set mode togpu
orcpu
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 theavailable_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']
-
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()
Scene
defines the contents of the scene to be traced, including any number ofGeometry
objects, theCamera
, thebackground_color
,background_alpha
, andlights
.Every
Scene
must be associated with aDevice
. For convenience,Scene
creates a defaultDevice
when device isNone
.-
property
background_color
¶ Background color linear RGB.
Note
Use
fresnel.color.linear
to convert standard sRGB colors into the linear color space used by fresnel.- Type
((3, )
numpy.ndarray
ofnumpy.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.ndarray
ofnumpy.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