Enumerations and flags

Enumerations and flags used by PlotOptiX raytracer.

https://github.com/rnd-team-dev/plotoptix/blob/master/LICENSE.txt

Have a look at examples on GitHub: https://github.com/rnd-team-dev/plotoptix.

Scene

class plotoptix.enums.Postprocessing[source]

2D postprocessing stages.

Postprocessing stages can be added with plotoptix.NpOptiX.add_postproc() to correct ray traced 2D image. Each algorithm has its own variables that should be configured before adding the postprocessing stage.

Denoiser = 7

AI denoiser.

Variables to configure:

  • denoiser_blend, float, amount of original image mixed with denoiser output range: 0 (only denoiser output) to 1 (only original raytracing output)

  • denoiser_kind, int value of plotoptix.enums.DenoiserKind, decides which buffers are used as denoiser inputs

Examples

>>> optix = TkOptiX()
>>>
>>> optix.set_float("denoiser_blend", 0.5)
>>> optix.set_int("denoiser_kind", DenoiserKind.Rgb.value)
>>> optix.add_postproc("Denoiser")
Gamma = 2

Image gamma correction.

Variables to configure: - tonemap_exposure, float, exposure value - tonemap_gamma, float, gamma value.

Examples

>>> optix = TkOptiX()
>>> optix.set_float("tonemap_exposure", 0.6)
>>> optix.set_float("tonemap_gamma", 1/2.2)
>>> optix.add_postproc("Gamma")
GrayCurve = 3

Brightness correction curve.

Variables to configure:

Examples

>>> optix = TkOptiX()
>>> optix.set_float("tonemap_exposure", 0.6)
>>> optix.set_texture_1d("tone_curve_gray", [0, 0.33, 0.75, 1])
>>> optix.add_postproc("GrayCurve")
Levels = 1

Image levels correction.

Variables to configure: - levels_low_range, float3, RGB values - levels_high_range, float3, RGB values.

Examples

>>> optix = TkOptiX()
>>> optix.set_float("levels_low_range", 0.1, 0.15, 0.2)
>>> optix.set_float("levels_high_range", 0.9, 0.8, 0.7)
>>> optix.add_postproc("Levels")
Mask = 5

2D mask multiplied by the image.

Variables to configure:

  • frame_mask, grayscale texture 2D, mask to apply

Examples

>>> optix = TkOptiX()
>>>
>>> x = np.linspace(-1, 1, 20)
>>> z = np.linspace(-1, 1, 20)
>>> Mx, Mz = np.meshgrid(x, z)
>>> M = np.abs(Mx) ** 3 + np.abs(Mz) ** 3
>>> M = 1 - (0.6 / np.max(M)) * M
>>>
>>> optix.set_texture_2d("frame_mask", M)
>>> optix.add_postproc("Mask")
Overlay = 6

2D overlay, added to the image according to alpha channel.

Variables to configure:

  • frame_overlay, RGBA texture 2D, an overlay to add

Examples

>>> optix = TkOptiX()
>>>
>>> # ...read or create overlay image
>>>
>>> optix.set_texture_2d("frame_overlay", M)
>>> optix.add_postproc("Overlay")
RgbCurve = 4

RGB correction curve.

Variables to configure:

  • tonemap_exposure, float, exposure value

  • tone_curve_r, texture 1D, red channel correction curve

  • tone_curve_g, texture 1D, green channel correction curve

  • tone_curve_b, texture 1D, blue channel correction curve

Correction curves can be configured by passing the values directly (using plotoptix.NpOptiX.set_texture_1d()) or with plotoptix.NpOptiX.set_correction_curve()

Examples

>>> optix = TkOptiX()
>>> optix.set_float("tonemap_exposure", 0.6)
>>> optix.set_texture_1d("tone_curve_r", [0, 0.31, 0.75, 1])
>>> optix.set_texture_1d("tone_curve_g", [0, 0.33, 0.78, 1])
>>> optix.set_texture_1d("tone_curve_b", [0, 0.35, 0.81, 1])
>>> optix.add_postproc("RgbCurve")
class plotoptix.enums.DenoiserKind[source]

Inputs provided to the denoiser.

Rgb = 8961

Only raw RGB values are used. Use this mode to save memory or if denoising in other modes is not satisfactory.

RgbAlbedo = 8962

Default mode. Raw RGB values and surface albedo are used.

RgbAlbedoNormal = 8963

Raw RGB values, surface albedo and normals are used. Use this mode for scenes with fine details of surface structures.

class plotoptix.enums.MissProgram[source]

Miss program.

Miss program is executed when ray segment is not intersecting any object at a defined maximum distance. Radiance assigned to the ray by the miss program appears as a color of the background (i.e. on primary segments) or environmental light color (segments scattered off a diffuse surfaces) or sub-surface color (segments scattered inside volumes).

AmbientAndVolume = 2

Same as plotoptix.enums.MissProgram.AmbientLight but supports volumetric scattering (just a tiny fraction slower).

AmbientLight = 1

Background color is used if the ray is not scattering of any surface; ambient light color is used otherwise (e.g. background can be black while the scene is illuminated with any color of light).

Default = 0

Constant background color is used.

TextureEnvironment = 4

Texture color is used for both, the background and the scene illumination. Texture pixel is selected by the ray direction, so effectively the texture is mapped on the sphere with infinite radius: use 360 deg environment maps. This mode supports volumetric scattering.

TextureFixed = 3

Texture color is used if the ray is not scattering of any surface; ambient light color is used otherwise. Texture in the background is not reacting to the camera changes and is not affacting the scene illumination. This mode supports volumetric scattering.

Geometry

class plotoptix.enums.Geometry[source]

Geometry shapes.

BSplineCubic = 13

Cubic b-spline with nodes at data points.

Line thickness and color can be provided for each data point (curve node).

Note: b-spline is not interpolating data points; see examples how to pin start/end to a fixed position. Use plotoptix.enums.Geometry.BezierChain for a smooth curve interpolating all data points.

BSplineQuad = 12

Quadratic b-spline with nodes at data points.

Line thickness and color can be provided for each data point (curve node).

Note: b-spline is not interpolating data points; see examples how to pin start/end to a fixed position. Use plotoptix.enums.Geometry.BezierChain for a smooth curve interpolating all data points.

BezierChain = 6

Bezier line interpolating data points.

Line thickness and color can be provided for each data point (curve node).

Curve is smoothed, use plotoptix.enums.Geometry.SegmentChain for a piecewise linear plot.

Graph = 14

Graph or a wireframed mesh.

Color and radius can be provided for each data point (graph vertex).

Mesh = 10

Mesh.

Color and normal vectors can be provided for each data point (mesh vertex).

Parallelepipeds = 8

Parallelepipeds.

Color and U / V / W vectors can be provided for each data point.

Parallelograms = 7

Flat parallelograms.

Color and parallelogram U / V vectors can be provided for each data point.

ParticleSet = 1

Spherical particle for each data point.

Each point can have individual radius and color.

ParticleSetTextured = 4

Spherical particle, 3D oriented, for each data point.

Each point can have individual radius and color. U and V vectors allow for 3D orientation of each point so it can works best with textures. Texture overrides individual flat colors of particles.

U vector points to the north of the particle, V vector sets the zero longitude direction. V vector is orthogonalized to U.

SegmentChain = 11

Linear segments connecting data points.

Line thickness and color can be provided for each data point (node).

Tetrahedrons = 9

Tetrahedrons.

Color and U / V / W vectors can be provided for each data point.

Unknown = 0

Value reserved for errors.

class plotoptix.enums.GeomBuffer[source]

Geometry buffer flags.

Flags are used for:

All = 4294967295

All buffers.

Colors = 12

Any geometry color, including start/end of bezier and line segments.

Allocated on the first access (otherwise constant color is used).

Colors0 = 4

Bezier segments starting color.

Colors1 = 8

Bezier segments end color.

EdgeIdx = 32768

Doublets of mesh or graph edge indexes.

Allocated on the first access in meshes.

FaceIdx = 4096

Triplets of mesh face indexes.

NormalIdx = 8192

Mesh normal indexes.

Positions = 1

Data points positions.

Radii = 16

Particles radii, bezier and line segment thickness.

TextureMap = 16384

Tecture UV coordinates.

U = 32

U vector of parallelograms, parallelepipeds and tetrahedrons.

V = 64

V vector of parallelograms, parallelepipeds and tetrahedrons.

V0 = 256

Start node of bezier segments.

V1 = 512

1st mid node of bezier segments.

V2 = 1024

2nd mid node of bezier segments.

V3 = 2048

End node of bezier segments.

VNodes = 3840

All nodes of bezier and line segments.

Vectors = 224

All vectors of parallelograms, parallelepipeds and tetrahedrons; normal vectors of meshes.

Velocities = 2

Velocities of data points / curve nodes / mesh vertices.

Used only on the host side, for the simulation support. Allocated on the first access.

VertexIdx = 4096

Triplets of mesh face indexes (to be replaced with the FaceIdx name).

W = 128

W vector of parallelograms, parallelepipeds and tetrahedrons.

class plotoptix.enums.GeomAttributeProgram[source]

Geometry attributes program.

Executed to find the closest ray-object intersection. Calculates the geometry normal and texture coordinates.

Default = 0
DisplacedSurface = 2

Displaced surface position.

Modifies surface position according to the provided texture. Available with textured particles.

class plotoptix.enums.TextureMapping[source]

Texture projection mode.

Flat = 1

Orthogonal projection on a flat surface.

Spherical = 2

Projection on a spherical surface.

class plotoptix.enums.TextureAddressMode[source]

Texture addressing mode on edge crossing.

class plotoptix.enums.DisplacementMapping[source]

Surface displacement mapping mode.

DisplacedSurface = 2

Surface is actually displaced, shading normal is tilted accordingly.

NormalTilt = 1

Only the shading normal is affected.

Camera

class plotoptix.enums.Camera[source]

Cameras (ray generation programs).

CustomProj = 98

Custom projection camera.

Ray angles are defined with a 2D texture [height, width, 2] composed of angles [horizontal, vertical] w.r.t. the camera axis. Angles should be provided in radians, and normalized so the value 1.0 is corresponding to pi. Negative angles are to the left (horizontal) and down (vertical) w.r.t. the camera axis.

Exact values from the texture are used if the render size and texture size are the same. Otherwise ray angles are interpolated.

CustomProjXYZ = 97

Custom projection camera.

Rays are defined with a 4D texture [height, width, 4] composed of target points and maximum range [x, y, z, r]. Range value set to 0.0 is converted to distance from the camera position to [x, y, z]; negative range values are replaced with the infinite range.

Exact values from the texture are used if the render size and texture size are the same. Otherwise target points are interpolated.

CustomProjXYZtoDir = 95

Custom projection camera.

Rays are defined with two 4D textures [height, width, 4]. First one is composed of origin points [x, y, z, 0]. Second texture contains ray directions and maximum ranges [cosx, cosy, cosz, r]. All values are in the world space. Negative range values are replaced with the infinite range.

Exact values from the texture are used if the render size and texture size are the same, otherwise values are interpolated. Textures can have different sizes.

CustomProjXYZtoXYZ = 96

Custom projection camera.

Rays are defined with two 4D textures [height, width, 4]. First one is composed of origin points [x, y, z, 0]. Second texture contains ray target points and maximum ranges [x, y, z, r]. All values are in the world space. Negative range values are replaced with the infinite range.

Exact values from the texture are used if the render size and texture size are the same, otherwise values are interpolated. Textures can have different sizes.

DoF = 1

Thin lens perspective camera with depth of field simulation.

This camera produces ideal, straight perspective lines.

Fisheye = 4

Fisheye (equisolid) camera with depth of field simulation.

This camera renders a fisheye lens distortion of perspective lines. It also focuses on a sphere rather than on a plane like thin lens camera.

FisheyeChroma = 6

Fisheye (equisolid) camera with depth of field and chromatic abberation simulation.

This camera renders a fisheye lens distortion of perspective lines. It also focuses on a sphere rather than on a plane like thin lens camera.

Ortho = 3

Orthogonal projection camera.

Panoramic = 2

360 deg panoramic (equirectangular) camera.

Pinhole = 0

Perspective camera.

TexTest = 99

Test texture mapping in the camera shader.

ThinLens = 1

Alias for DoF.

Actually a better name that should replace DoF at some point.

ThinLensChroma = 5

Thin lens perspective camera with depth of field and chromatic abberation simulation.

This camera produces ideal, straight perspective lines.

Lights

class plotoptix.enums.LightShading[source]

Light shading program.

Hard = 1

Hard light shading.

Slower convergence (more frames required to eliminate noise), but much better suited for scenes with caustics.

Soft = 0

Soft light shading.

Raytracing in this mode converges quickly and lighting is well balanced for most scenes and light sources.

class plotoptix.enums.Light[source]

Light sources.

Parallelogram = 0

Flat parallelogram, light on front face only.

Spherical = 1

Spherical light, shining in all directions.

Encoder

class plotoptix.enums.NvEncProfile[source]

H.264 encoding profile.

Beware that some combinations are not supported by all players (e.g. lossless encoding is not playable in Windows Media Player).

Baseline = 1
Default = 0
High = 3
High444 = 4
Main = 2
class plotoptix.enums.NvEncPreset[source]

H.264 encoding preset.

Beware that some combinations may not be supported by all players (e.g. lossless encoding is not playable in Windows Media Player).

BD = 3
Default = 0
HP = 1
HQ = 2
LL = 4
LL_HP = 5
LL_HQ = 6
Lossless = 7
Lossless_HP = 8

Ray tracer

class plotoptix.enums.RtResult[source]

Raytracing result codes.

AccumDone = 1

Last accumulation frame completed.

Image is ready, raytracng stops until changes in the scene are made.

ComputeTimeout = 256

Compute/upload task timed out.

LaunchTimeout = 257

Ray-tracing task timed out.

NoUpdates = 2

There is no change in the output image.

Success = 0

Frame raytracing completed with no errors.

class plotoptix.enums.RtFormat[source]

OptiX buffer formats.

Float = 257

32 bit single precision scalars.

Float2 = 258

32 bit single precision 2D vectors.

Float3 = 259

32 bit single precision 3D vectors.

Float4 = 260

32 bit single precision (x, y, z, w) vectors.

UByte = 265

8 bit unsigned integer scalars.

UByte2 = 266

8 bit unsigned integer 2D vectors.

UByte4 = 268

8 bit unsigned integer (x, y, z, w) vectors.

Unknown = 256

Reserved.

class plotoptix.enums.GpuArchitecture[source]

SM architecture.

Auto = 0

Select highest SM architecture matching available GPU’s.

Compute_50 = 500

Maxwell.

Compute_52 = 520

Maxwell.

Compute_60 = 600

Pascal.

Compute_61 = 610

Pascal.

Compute_70 = 700

Volta.

Compute_75 = 750

Turing.

Compute_86 = 860

Ampere.

Other

class plotoptix.enums.Coordinates[source]

Coordinate system styles.

Note, implementation of the coordinate system geometries is ongoing. Now only a simple box containing the data points is ready to use.

Box = 1

Box containing all the data points.

Hidden = 0

No coordinate system in the image.

class plotoptix.enums.Channel[source]

Image color channel.

A = 4

Alpha channel.

B = 3

Blue channel.

G = 2

Green channel.

Gray = 0

Brightness.

R = 1

Red channel.

class plotoptix.enums.ChannelOrder[source]

Color channel ordering.

BGR = 2
BGRA = 4
RGB = 1
RGBA = 3
class plotoptix.enums.ChannelDepth[source]

Color channel depth: 8, 16 or 32 bits per sample.

Bps16 = 2
Bps32 = 3
Bps8 = 1