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(value)[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, LDR model.

This model is applied to the image after tone mapping. Image values are clamped to the <0, 1> range at the denoiser input. Use appropriate exposure to scale the image into that range; the gamma value should be about 2.2 (see plotoptix.enums.Postprocessing.Gamma).

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_start, uint, number of the accumulation frame after which denoiser is applied; default velue is 4; see also denoiser_start in raytracer configuration

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

Examples

>>> rt = TkOptiX()
>>>
>>> rt.set_float("denoiser_blend", 0.5)
>>> rt.set_uint("denoiser_start", 12)
>>> rt.set_int("denoiser_kind", DenoiserKind.Rgb.value)
>>> rt.add_postproc("Denoiser")
DenoiserHDR = 8

AI denoiser, HDR model.

This model is applied to the raw hdr image, before any other postprocessing.

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_start, uint, number of the accumulation frame after which denoiser is applied; default velue is 4; see also denoiser_start in raytracer configuration

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

Examples

>>> rt = TkOptiX()
>>>
>>> rt.set_float("denoiser_blend", 0.5)
>>> rt.set_uint("denoiser_start", 12)
>>> rt.set_int("denoiser_kind", DenoiserKind.Rgb.value)
>>> rt.add_postproc("DenoiserHDR")
DenoiserUp2x = 9

AI denoiser, HDR model with upscaling x2.

This model is applied to the raw hdr image, before any other postprocessing. It is simultaneously upsizing the image by the factor of 2. When this denoiser is included in the postprocessing, all ray tracing happens in the resolution 2x lower than width and height set in plotoptix.NpOptiX object.

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_start, uint, number of the accumulation frame after which denoiser is applied; default velue is 4; see also denoiser_start in raytracer configuration

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

Examples

>>> rt = TkOptiX()
>>>
>>> rt.set_float("denoiser_blend", 0.0)
>>> rt.set_uint("denoiser_start", 12)
>>> rt.set_int("denoiser_kind", DenoiserKind.Rgb.value)
>>> rt.add_postproc("DenoiserUp2x")
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")
OIDenoiser = 10

Intel Open Image denoiser, LDR model.

This model is applied to the image after tone mapping. Image values are clamped to the <0, 1> range at the denoiser input. Use appropriate exposure to scale the image into that range; the gamma value should be about 2.2 (see plotoptix.enums.Postprocessing.Gamma).

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_start, uint, number of the accumulation frame after which denoiser is applied; default velue is 4; see also denoiser_start in raytracer configuration

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

Examples

>>> rt = TkOptiX()
>>>
>>> rt.set_float("denoiser_blend", 0.5)
>>> rt.set_uint("denoiser_start", 12)
>>> rt.set_int("denoiser_kind", DenoiserKind.Rgb.value)
>>> rt.add_postproc("OIDenoiser")
OIDenoiserHDR = 11

Intel Open Image denoiser, HDR model.

This model is applied to the raw hdr image, before any other postprocessing.

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_start, uint, number of the accumulation frame after which denoiser is applied; default velue is 4; see also denoiser_start in raytracer configuration

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

Examples

>>> rt = TkOptiX()
>>>
>>> rt.set_float("denoiser_blend", 0.5)
>>> rt.set_uint("denoiser_start", 12)
>>> rt.set_int("denoiser_kind", DenoiserKind.Rgb.value)
>>> rt.add_postproc("OIDenoiserHDR")
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(value)[source]

Buffers used by the denoiser.

Albedo = 2

Albedo buffer, must be used together with plotoptix.enums.DenoiserKind.Rgb.

Normal = 4

Normal buffer, must be used together with plotoptix.enums.DenoiserKind.Rgb and plotoptix.enums.DenoiserKind.Albedo.

Prev = 8

Previous temporal frame - reserved for the future use.

Rgb = 1

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

RgbAlbedo = 3

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

RgbAlbedoNormal = 7

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

class plotoptix.enums.MissProgram(value)[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, Materials

class plotoptix.enums.Geometry(value)[source]

Geometry shapes.

BSplineCubic = 13

Cubic b-spline with nodes at data points.

Curve 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.

Curve 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 curve interpolating data points.

Curve thickness and color can be provided for each data point (curve node). You only need to provide data points. Bezier control points are calculated internally to obtain a smooth continuous curve. This implementation is faster than the OptiX native used in plotoptix.enums.Geometry.Beziers though some artifacts might occur if curve sections are long.

For a piecewise linear plot use plotoptix.enums.Geometry.SegmentChain.

Beziers = 16

Bezier curves with data points used as control points for each independent segment (OptiX native implementation).

Curve thickness and color can be provided for each data point (bezier control point). Each segment is described with 4 control points: start, ctrl #1, ctrl #2, end. Multiple segments are described with an array of control point 3D positions (colors, radii) of successive segments, i.g. N segments will require an array (4*N,3) of positions, an array (4*N,3) of colors and an array (N,) of radii, see also 2_beziers.py in basic code examples.

CatmullRom = 15

Catmull-Rom spline with nodes at data points.

Curve thickness and color can be provided for each data point (curve node). Curve interpolates its data points (nodes) exactly.

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.

ParallelepipedsConstSize = 20

Parallelepipeds with shared U / V / W vectors.

Color can be provided for each data point but geometry of each primitive is identical. Shared U / V / W vectors reduce memory usage and improve ray-tracing efficiency.

Parallelograms = 7

Flat parallelograms.

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

ParallelogramsConstSize = 19

Flat parallelograms with shared U and V vectors.

Color can be provided for each data point but geometry of each primitive is identical. Shared U / V vectors reduce memory usage and improve ray-tracing efficiency.

ParticleSet = 1

Spherical particle for each data point.

Each point can have individual radius and color.

ParticleSetConstSize = 18

Spherical particle with shared radius.

Color can be provided for each data point but geometry (radius) of each primitive is identical. Shared radius reduces memory usage and improves ray-tracing efficiency.

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.

Ribbon = 17

Flat quadratic b-spline with nodes at data points.

Width and color can be provided for each data point (ribbon node).

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(value)[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(value)[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(value)[source]

Texture projection mode.

Flat = 1

Orthogonal projection on a flat surface.

Spherical = 2

Projection on a spherical surface.

class plotoptix.enums.TextureAddressMode(value)[source]

Texture addressing mode on edge crossing.

Border = 3

Extend texture border.

Clamp = 1

Clamp texture.

Mirror = 2

Mirror texture.

Wrap = 0

Wrap texture.

class plotoptix.enums.TextureFilterMode(value)[source]

Texture sampling mode.

Nearest = 0

Nearest pixel.

Trilinear = 1

Linear interpolation.

class plotoptix.enums.DisplacementMapping(value)[source]

Surface displacement mapping mode.

DisplacedSurface = 2

Surface is actually displaced, shading normal is tilted accordingly.

NormalTilt = 1

Only the shading normal is affected.

class plotoptix.enums.MaterialType(value)[source]

Type of the material shader.

Used to select the shader program when creating a dictionary for the new material parameters.

Cosine = 1

Shaded transparency with cos(eye-hit-normal), fast.

Diffuse = 2

Lambertian and Oren-Nayar diffuse materials, no specular reflections, no transmission, no transparency, therefore a bit faster than other, more complex materials.

Flat = 0

Simple and fast flat color shading.

Reflective = 4

Supports all surfaces with specular reflections (also mixed with diffuse behavior), including metallic surface, with no transmission and no transparency support.

ShadowCatcher = 8

Shadow catcher, a diffuse material, transparent except shadowed regions. Useful for preparation of packshot style images.

ThinWalled = 7

Bubble-like, transmissive material with no refraction on the walls; includes volumetric scattering and emission.

Transmissive = 6

Glass-like, transmissive material with the light refraction and dispersion support; includes also volumetric scattering and emission.

TransparentDiffuse = 3

Diffuse material, similar to plotoptix.enums.MaterialType.Diffuse, but with the transparency support.

TransparentReflective = 5

Reflective material, similar to plotoptix.enums.MaterialType.Reflective, but with the transparency support.

Camera

class plotoptix.enums.Camera(value)[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.

class plotoptix.enums.WorkDistribution(value)[source]

Work distribution mode.

AbsNoiseBalanced = 2

More rays towards pixels a higher absolute noise.

NoiseBalanced = 1

More rays towards pixels with a higher relative noise, same as.

RelNoiseBalanced = 1

More rays towards pixels a higher relative noise.

Uniform = 0

Constant numbe of rays per pixel.

Lights

class plotoptix.enums.LightShading(value)[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(value)[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(value)[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(value)[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(value)[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(value)[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(value)[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(value)[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(value)[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(value)[source]

Color channel ordering.

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

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

Bps16 = 2
Bps32 = 3
Bps8 = 1