from .plot_base import PlotBase
from .plot_camera import PlotCameraMixin
from .plot_display import PlotDisplayMixin
from .plot_objects import PlotObjectsMixin
from .plot_serialization import PlotSerializationMixin
from .plot_snapshot import PlotSnapshotMixin
from .plot_time import PlotTimeMixin
[docs]
class Plot(
PlotObjectsMixin,
PlotDisplayMixin,
PlotCameraMixin,
PlotSnapshotMixin,
PlotSerializationMixin,
PlotTimeMixin,
PlotBase,
):
"""
Main K3D widget.
Attributes:
antialias: `int`:
Enable antialiasing in WebGL renderer, changes have no effect after displaying.
logarithmic_depth_buffer: `bool`.
Enables logarithmic_depth_buffer in WebGL renderer.
height: `int`:
Height of the Widget in pixels, changes have no effect after displaying.
background_color: `int`.
Packed RGB color of the plot background (0xff0000 is red, 0xff is blue), -1 is for transparent.
camera_auto_fit: `bool`.
Enable automatic camera setting after adding, removing or changing a plot object.
grid_auto_fit: `bool`.
Enable automatic adjustment of the plot grid to contained objects.
grid_color: `int`.
Packed RGB color of the plot grids (0xff0000 is red, 0xff is blue).
grid_visible: `bool`.
Enable or disable grid.
screenshot_scale: `Float`.
Multiplier to screenshot resolution. A screenshot is the plot's own width and
height times this, whatever resolution the interactive view happens to be
drawing at.
voxel_paint_color: `int`.
The (initial) integer value to be inserted when editing voxels.
label_color: `int`.
Packed RGB color of the labels (0xff0000 is red, 0xff is blue).
lighting: `Float`.
Lighting factor - the exposure knob. In the advanced renderer the
environment carries the shape of the light, lighting scales its energy.
renderer: `str`.
Rendering pipeline of the plot.
Legal values are:
:`simple`: the classic rasteriser with a fixed light rig (default),
:`advanced`: image-based lighting from the environment map, physically
based materials and ambient occlusion,
:`cinematic`: progressive path tracing with global illumination.
Requires WebGL2 with renderable float textures; when the browser
cannot run it, the switch fails with an error instead of falling
back to another renderer.
environment: `str` or `array_like`.
The light environment of the advanced renderer.
Legal values are:
:`neutral`: procedural achromatic gradient with a soft key light (default),
:`studio`: procedural gradient with two soft studio lights,
:`outdoor`: procedural sky with a sun disc and ground,
:name from k3d.environments.available(): a photographic HDRI shipped
with the package (Poly Haven, CC0),
:array_like: a custom (height, width, 3) float32 equirectangular
radiance map. Every map is energy-normalised.
environment_rotation: `float`.
Rotation of the environment map around the scene's up axis, in radians.
tone_mapping: `str`.
Tone curve applied by the advanced renderer.
Legal values are:
:`none`: linear output (default),
:`agx`: AgX filmic curve,
:`aces`: ACES filmic curve.
ao_radius: `float`.
Occlusion radius of the advanced renderer's ambient occlusion, as a
fraction of the scene's bounding-box diagonal, in (0, 1]. Default 0.07.
Dense point clouds and closed interiors usually want a smaller radius.
ao_strength: `float`.
Exponent deepening the ambient occlusion shadows, in [0, 10].
0 disables the darkening, default 1.8.
cinematic_samples: `int`.
Sample budget of the cinematic renderer, in [1, 100000]. Default 64,
which settles in a moment; raise it for a final render. The
interactive view accumulates one sample per animation frame up to
this budget, then parks itself; any change to the camera, the scene
or the lighting restarts the accumulation from zero. Screenshots
always render the full budget.
cinematic_bounces: `int`.
Light bounce count of the cinematic renderer's path tracing,
in [1, 32]. Default 6.
grid: `array_like`.
6-element tuple specifying the bounds of the plot grid (x0, y0, z0, x1, y1, z1).
camera: `array_like`.
9-element list or array specifying camera position.
camera_no_rotate: `Bool`.
Lock for camera rotation.
camera_no_zoom: `Bool`.
Lock for camera zoom.
camera_no_pan: `Bool`.
Lock for camera pan.
camera_rotate_speed: `Float`.
Speed of camera rotation.
camera_zoom_speed: `Float`.
Speed of camera zoom.
camera_pan_speed: `Float`.
Speed of camera pan.
camera_fov: `Float`.
Camera Field of View.
camera_damping_factor: `Float`.
Defines the intensity of damping. Default is 0 (disabled).
camera_up_axis: `str`.
Fixed up axis for camera.
Legal values are:
:`x`: x axis,
:`y`: y axis,
:`z`: z axis,
:`none`: no fixed up axis - the camera is free to roll.
snapshot_type: `string`.
Can be 'full', 'online' or 'inline'.
axes: `list`.
Axes labels for plot.
axes_helper: `Float`.
Axes helper size.
axes_helper_colors: `List`.
List of triple packed RGB color of the axes helper (0xff0000 is red, 0xff is blue).
time: `float`.
Time value (used in TimeSeries)
time_speed: `float`.
Time speed (used in TimeSeries)
name: `string`.
Name of the plot. Used to filenames of snapshot/screenshot etc.
mode: `str`.
Mode of K3D viewer.
Legal values are:
:`view`: No interaction with objects,
:`add`: On voxels objects adding mode,
:`change`: On voxels objects edit mode,
:`callback`: Handling click_callback and hover_callback on some type of objects,
:`manipulate`: Enable object transform widget.
camera_mode: `str`.
Mode of camera movement.
Legal values are:
:`trackball`: orbit around point with dynamic up-vector of camera,
:`orbit`: orbit around point with fixed up-vector of camera,
:`fly`: orbit around point with dynamic up-vector of camera, mouse wheel also moves target point.
manipulate_mode: `str`.
Mode of manipulate widgets.
Legal values are:
:`translate`: Translation widget,
:`rotate`: Rotation widget,
:`scale`: Scaling widget.
depth_peels: `int`.
Set the maximum number of peels to use. Disabled if zero.
With peeling on, volumes compose correctly with intersecting
meshes (the ray march is split at the layer depths); use
depth_peels >= 3, below that the effect is unpredictable.
cinematic_glossy_filter: `Float`.
How much the cinematic renderer widens a glossy lobe in proportion to
the roughness already gathered along a path, in [0, 1]. Default 0.25.
It removes fireflies where they live and leaves a specular seen
directly untouched; 0 disables it.
cinematic_seed: `int` or `None`.
Seed of the path tracer's sample sequence, an int in the range [1, 2**31 - 1]. With
None every accumulation starts from fresh noise; with a seed the same scene renders
the same image every time. 0 is refused, so that "unset" and "seeded" never blur.
cinematic_denoise: `Float`.
How much of the denoised image the cinematic renderer shows. Default 0 is off, and the
only value that leaves the image exactly as it was traced; 1 shows the image Open Image
Denoise makes of it. Between the two they are mixed, which is not a strength: OIDN has
none, and a mix keeps that share of the grain along with the texture the network smooths
- worth it from about 0.7 up. Above 1 is the same as 1. The
denoiser runs once the accumulation reaches cinematic_samples - while it accumulates
the trace is shown as it is - and needs WebGPU: without it the image is shown
undenoised and the console says why. On surfaces it is guided by their albedo and
normals; inside a volume by the colour alone. Measured on a CT heart against 2048
samples, 16 samples denoised are as close as 64 filtered by the earlier denoiser and
closer than 128 untouched, with no structure added beyond what two 2048-sample renders
differ by - but at low budgets it smooths texture one or two pixels across.
cinematic_bokeh_size: `Float`.
Diameter of the cinematic renderer's aperture, in scene units. Default 0,
a pinhole - everything in focus, and the only value that leaves the image
identical to the other renderers. Anything above it defocuses whatever is
not at the focus distance, and costs a shader recompile the first time it
leaves zero.
cinematic_focus_distance: `Float`.
How far in front of the camera the cinematic renderer focuses, in scene
units. Default 0 means the camera's own target, so the plot is sharp where
you are looking. Ignored while cinematic_bokeh_size is 0.
cinematic_aperture_blades: `Int`.
How many blades the cinematic renderer's iris has: 0, the default, is a
perfect circle, and 3 to 16 give an aperture of that many sides, which is
what makes an out-of-focus highlight read as hexagonal rather than round.
Ignored while cinematic_bokeh_size is 0.
menu_visibility: `Bool`.
Whether the panel in the top right corner is shown.
colorbar_object_id: `int`.
Id of the object whose color map the colorbar shows. -1 picks the
first object that has a color range.
fps_meter: `Bool`.
Whether to show the frames-per-second counter. It measures animation
frames, not draws: an idle plot draws nothing and the meter still
ticks.
time_interpolation: `Bool`.
Whether a time series blends between the two nearest keyframes. With
it off, playback steps from frame to frame.
custom_data: `dict`.
Anything you want to travel with the plot. K3D neither reads nor
validates it.
render_on_change: `Bool`.
Whether adding or updating an object draws a frame on its own. With it off,
call plot.render() yourself. It has never controlled a render loop - K3D
draws only when something changed. Named auto_rendering before 3.0.0.
fps: `Float`.
Fps of animation.
minimum_fps: `Float`.
If negative then disabled. Set target FPS to adaptative resolution.
objects: `list`.
List of `k3d.objects.Drawable` currently included in the plot, not to be changed directly.
additional_js_code: `str`.
Additional Js code that will be run after plot is initialized
"""
pass
__all__ = ["Plot"]