Skip to content

Commit 5dbfda4

Browse files
authored
Merge pull request #57 from rnd-team-dev/r0.18.0
R0.18.0
2 parents dc38b7a + 0c14101 commit 5dbfda4

File tree

116 files changed

+753
-238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+753
-238
lines changed

CHANGELOG.rst

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
11
Release history
22
===============
33

4+
`v0.18.1` - 2024-03-09
5+
----------------------
6+
7+
Added
8+
~~~~~
9+
10+
- Intel Open Image Denoiser libraries: HDR/LDR, supporting RGB/Albedo/Normal inputs.
11+
- Optional counting of transmission path segments (previously they were counted always and included in
12+
the segment range limits).
13+
- Const-size geometry primitives (same radii, or u/v/w vectors for all data points) with much lower memory
14+
consumption, beneficial e.g. for volume plots.
15+
- Volume coloring material for semi-transparent volume visualization (experimental).
16+
17+
Changed
18+
~~~~~~~
19+
20+
- Reviewed and improved camera kernels.
21+
22+
Fixed
23+
~~~~~
24+
25+
- Require min SM 5.0 instead of 6.0.
26+
- Minor lighting issues with masked transparency materials.
27+
28+
429
`v0.17.1` - 2023-10-06
530
----------------------
631

732
Added
833
~~~~~
934

10-
- Noise-balanced work distribution: absolute and relative noise modes
35+
- Noise-balanced work distribution: absolute and relative noise modes.
1136

1237

1338
`v0.17.0` - 2023-08-18
@@ -617,6 +642,7 @@ Added
617642
- this changelog, markdown description content type tag for PyPI
618643
- use [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
619644

645+
.. _`v0.18.1`: https://github.com/rnd-team-dev/plotoptix/releases/tag/v0.18.1
620646
.. _`v0.17.1`: https://github.com/rnd-team-dev/plotoptix/releases/tag/v0.17.1
621647
.. _`v0.17.0`: https://github.com/rnd-team-dev/plotoptix/releases/tag/v0.17.0
622648
.. _`v0.16.1`: https://github.com/rnd-team-dev/plotoptix/releases/tag/v0.16.1

LICENSE.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ The Software includes binary libraries from the following sources. Before procee
2525
4. .NET components:
2626
MIT License (https://github.com/dotnet)
2727

28+
5. Intel Open Image Denoise:
29+
Apache License 2.0 (https://github.com/OpenImageDenoise/oidn/blob/master/LICENSE.txt)
30+
2831
Section II: The Software End User License Agreement
2932
---------------------------------------------------
3033

MANIFEST.in

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ PlotOptiX
1313

1414
**Data visualisation and ray tracing in Python based on NVIDIA OptiX framework.**
1515

16-
`Docs <https://plotoptix.rnd.team>`__
16+
`Documentation <https://plotoptix.rnd.team>`__
1717

18-
- Have a look what is possible with PlotOptiX: `Behance <https://www.behance.net/RnDTeam>`__, `Instagram <https://www.instagram.com/rnd.team.studio/>`__, and `Facebook <https://www.facebook.com/rndteam>`__.
19-
- Join us on `Patreon <https://www.patreon.com/rndteam?fan_landing=true>`__ for news, release plans and hi-res content.
18+
- Sample images created with PlotOptiX: `Behance <https://www.behance.net/RnDTeam>`__, `Instagram <https://www.instagram.com/rnd.team.studio/>`__, and `Facebook <https://www.facebook.com/rndteam>`__.
19+
- Join `Patreon <https://www.patreon.com/rndteam?fan_landing=true>`__ for news, release plans and hi-res content.
2020

2121
PlotOptiX is a 3D `ray tracing <https://en.wikipedia.org/wiki/Ray_tracing_(graphics)>`__ package for Python, aimed at easy and aesthetic visualization
2222
of large datasets (and small as well). Data features can be represented in images as a position, size/thickness and color of primitives
@@ -44,7 +44,7 @@ No need to write shaders, intersection algorithms, handle 3D scene technicalitie
4444

4545
Check `examples on GitHub <https://github.com/rnd-team-dev/plotoptix/tree/master/examples>`__ for practical code samples and `documentation pages <https://plotoptix.rnd.team>`__ for a complete API reference.
4646

47-
PlotOptiX is a set of CUDA shaders by `R&D Team <https://rnd.team>`_ wrapped in C#/C++ libraries with a Python API. PlotOptiX is based on `NVIDIA OptiX 7.7 <https://developer.nvidia.com/optix>`_ framework and makes use of RTX-capable GPU's.
47+
PlotOptiX is a set of CUDA shaders by `R&D Team <https://rnd.team>`_ wrapped in C#/C++ libraries with a Python API. It is based on `NVIDIA OptiX 7.7 <https://developer.nvidia.com/optix>`_ framework and makes use of RTX-capable GPU's.
4848

4949
You can quickly display data in a simple plot:
5050

@@ -64,7 +64,7 @@ Features
6464
- *geometries*: particles (spheres), parallelepipeds, parallelograms, tetrahedrons, linear segments, bezier curves, b-splines; *meshes*: shaded surface or wireframe, automatically generated from a parametric surface or f(x,y) data, or defined with vertices and faces, e.g. created with `pygmsh <https://github.com/nschloe/pygmsh>`__, or loaded from a file, e.g. supported by `trimesh <https://github.com/mikedh/trimesh>`__, or loaded from a Wavefront .obj file with a native loader
6565
- *materials*: flat, diffuse, reflective, refractive; including: light dispersion, surface roughness and metalness, volume scattering, and nested volumes
6666
- *light sources*: spherical and parallelogram, light emission in volumes, uniform environmental light or environment map
67-
- *post-processing*: tonal correction curves, levels adjustment, apply mask/overlay, AI denoiser and upsampler
67+
- *post-processing*: tonal correction curves, levels adjustment, apply mask/overlay, AI denoisers and upsampler (OptiX native and Intel Open Image models)
6868
- *callbacks*: at the scene initialization, start and end of each frame raytracing, end of progressive accumulation
6969
- 8/16/32bps(hdr) image output to `numpy <https://numpy.org>`__ array, or save to popular image file formats
7070
- zero-copy access to GPU buffers wrapped in ndarrays: 8/32bpc image, hit and object info, albedo, normals

docs/enums.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ Camera
3838

3939
.. autoclass:: plotoptix.enums.Camera
4040
:members:
41+
.. autoclass:: plotoptix.enums.WorkDistribution
42+
:members:
4143

4244
Lights
4345
------

docs/npoptix_geometry.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Create, load, update, and remove a plot
1616
.. automethod:: plotoptix.NpOptiX.update_mesh
1717
.. automethod:: plotoptix.NpOptiX.load_mesh_obj
1818
.. automethod:: plotoptix.NpOptiX.load_merged_mesh_obj
19+
.. automethod:: plotoptix.NpOptiX.load_multiple_mesh_obj
1920
.. automethod:: plotoptix.NpOptiX.set_displacement
2021
.. automethod:: plotoptix.NpOptiX.load_displacement
2122
.. automethod:: plotoptix.NpOptiX.delete_geometry

docs/utils.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ Utility functions
44
Colors
55
------
66

7-
.. automethod:: plotoptix.utils.make_color
8-
.. automethod:: plotoptix.utils.make_color_2d
9-
.. automethod:: plotoptix.utils.map_to_colors
7+
.. autofunction:: plotoptix.utils.make_color
8+
.. autofunction:: plotoptix.utils.make_color_2d
9+
.. autofunction:: plotoptix.utils.map_to_colors
1010

1111
Image I/O
1212
---------
1313

14-
.. automethod:: plotoptix.utils.get_image_meta
15-
.. automethod:: plotoptix.utils.read_image
14+
.. autofunction:: plotoptix.utils.get_image_meta
15+
.. autofunction:: plotoptix.utils.read_image
1616

1717
Noise generators
1818
----------------
1919

20-
.. automethod:: plotoptix.utils.simplex
20+
.. autofunction:: plotoptix.utils.simplex
2121

2222
Miscellaneous
2323
-------------
2424

25-
.. automethod:: plotoptix.utils.get_gpu_architecture
26-
.. automethod:: plotoptix.utils.set_gpu_architecture
25+
.. autofunction:: plotoptix.utils.get_gpu_architecture
26+
.. autofunction:: plotoptix.utils.set_gpu_architecture
2727

2828
.. toctree::
2929
:caption: API Reference

examples/1_basics/1_scatter_plot_3d.py

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,44 +39,51 @@ def main():
3939

4040
# Create plots:
4141

42-
optix = TkOptiX() # create and configure, show the window later
42+
rt = TkOptiX() # create and configure, show the window later
4343

4444
# accumulate up to 30 frames (override default of 4 frames)
45-
optix.set_param(max_accumulation_frames=30)
45+
rt.set_param(max_accumulation_frames=30)
4646

4747
# white background
48-
optix.set_background(0.99)
48+
rt.set_background(0.99)
4949

50-
# add plots, ParticleSet geometry is default
51-
optix.set_data("particles", pos=particles, r=rp, c=cp)
52-
# and use geom parameter to specify cubes geometry;
50+
# add plots, ParticleSet geometry with variable radius is default
51+
rt.set_data("particles", pos=particles, r=rp, c=cp)
52+
#rt.set_data("particles", pos=particles, r=0.02, c=cp, geom="ParticleSetConstSize")
53+
54+
# use geom parameter to specify cubes geometry;
5355
# Parallelepipeds can be described precisely with U, V, W vectors,
5456
# but here we only provide the r parameter - this results with
55-
# randomly rotated cubes of U, V, W lenghts equal to r
56-
optix.set_data("cubes", pos=cubes, r=rc, c=cc, geom="Parallelepipeds")
57+
# randomly rotated cubes of U, V, W lenghts equal to r
58+
rt.set_data("cubes", pos=cubes, r=rc, c=cc, geom="Parallelepipeds")
5759

5860
# tetrahedrons look good as well, and they are really fast on RTX devices:
59-
#optix.set_data("tetras", pos=cubes, r=rc, c=cc, geom="Tetrahedrons")
61+
#rt.set_data("tetras", pos=cubes, r=rc, c=cc, geom="Tetrahedrons")
6062

6163
# if you prefer cubes aligned with xyz:
62-
#optix.set_data("cubes", pos=cubes, r=rc, c=cc, geom="Parallelepipeds", rnd=False)
64+
#rt.set_data("cubes", pos=cubes, r=rc, c=cc, geom="Parallelepipeds", rnd=False)
6365

64-
# or if you'd like some edges fixed:
66+
# or if you'd like to fix some edges:
6567
#v = np.zeros((rc.shape[0], 3)); v[:,1] = rc[:]
66-
#optix.set_data("cubes", pos=cubes, u=[0.05,0,0], v=v, w=[0,0,0.05], c=cc, geom="Parallelepipeds")
68+
#rt.set_data("cubes", pos=cubes, u=[0.05,0,0], v=v, w=[0,0,0.05], c=cc, geom="Parallelepipeds")
69+
70+
# or maybe fix geometry of all primitives (note "ConstSize" in geom name):
71+
#rt.set_data("cubes", pos=cubes, u=[0.02,0,0], v=[0,0.05,0], w=[0,0,0.08], c=cc, geom="ParallelepipedsConstSize")
72+
# or, if cubes are needed, simpy:
73+
#rt.set_data("cubes", pos=cubes, r=0.05, c=cc, geom="ParallelepipedsConstSize")
6774

6875
# show coordinates box
69-
optix.set_coordinates()
76+
rt.set_coordinates()
7077

7178
# show the UI window here - this method is calling some default
7279
# initialization for us, e.g. creates camera, so any modification
7380
# of these defaults should come below (or we provide on_initialization
7481
# callback)
75-
optix.show()
82+
rt.show()
7683

7784
# camera and lighting configured by hand
78-
optix.update_camera(eye=[5, 0, -8])
79-
optix.setup_light("light1", color=10*np.array([0.99, 0.9, 0.7]), radius=2)
85+
rt.update_camera(eye=[5, 0, -8])
86+
rt.setup_light("light1", color=10*np.array([0.99, 0.9, 0.7]), radius=2)
8087

8188
print("done")
8289

examples/1_basics/1_volume_plot.py

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
"""
2+
Opaque volume plot.
3+
4+
This example shows how to:
5+
- use const-sized cubes to plot volume shape (opaque)
6+
- present data feature as a color
7+
- use matplotlib color map (see https://matplotlib.org/users/colormaps.html)
8+
"""
9+
10+
import numpy as np
11+
from plotoptix import TkOptiX
12+
from plotoptix.utils import map_to_colors # feature to color conversion
13+
from plotoptix.enums import DenoiserKind # deniser options
14+
15+
from plotoptix.utils import simplex # noise generator
16+
_ = simplex(np.zeros((3,3)))
17+
18+
19+
def main():
20+
21+
# Make some data first:
22+
23+
kx, ky, kz = (500, 500, 250)
24+
scale = 0.02
25+
26+
x = np.linspace(0, kx, kx)
27+
y = np.linspace(0, ky, ky)
28+
z = np.linspace(0, kz, kz)
29+
xv, yv, zv = np.meshgrid(x, y, z)
30+
xyz = scale * np.stack((xv, yv, zv), axis=-1)
31+
32+
vol = simplex(xyz)
33+
print("Volume shape:", vol.shape)
34+
35+
vmin, vmax = (-0.1, 0.1)
36+
37+
selection = (vol > vmin) & (vol < vmax)
38+
sel_cubes = xyz[selection]
39+
colors = map_to_colors(vol[selection], "Reds")
40+
41+
print(f"{np.sum(selection) / 1.0e6 :.1f}M seleced cells.")
42+
43+
# Setup ray-tracing:
44+
45+
rt = TkOptiX() # create and configure, show the window later
46+
47+
max_frames = 32 # accumulation frames (rays/pixel in other words)
48+
rt.set_param(
49+
min_accumulation_step=4,
50+
max_accumulation_frames=max_frames
51+
)
52+
53+
rt.set_float("scene_epsilon", 1.0e-05) # expect small cubes, lower epsilon to ensure details are correctly presented
54+
rt.set_uint("path_seg_range", 4, 16) # shape can have copmplex cavities that look better with multiple ray scattering
55+
56+
rt.set_background(0.99) # plot background color
57+
rt.set_ambient(0.8) # uniform environment light
58+
59+
# setup tone mapping and denoiser for best image quality
60+
exposure = 1.1
61+
gamma = 2.2
62+
rt.set_float("tonemap_exposure", exposure)
63+
rt.set_float("tonemap_gamma", gamma)
64+
rt.set_uint("denoiser_start", max_frames) # denoise only the final image
65+
rt.set_int("denoiser_kind", DenoiserKind.RgbAlbedoNormal.value)
66+
rt.add_postproc("OIDenoiser")
67+
68+
rt.setup_camera("cam1",
69+
eye=scale * np.array([kx/2, ky/2, 5*kz]),
70+
target=0.5 * scale * np.array([kx, ky, kz]),
71+
up=[0, 1, 0],
72+
fov=35
73+
)
74+
75+
# Create plot:
76+
77+
rt.set_data(
78+
"cubes", pos=sel_cubes,
79+
r=scale, # equivalent to: u=[scale, 0, 0], v=[0, scale, 0], w=[0, 0, scale],
80+
81+
# constant color:
82+
#c=0.9,
83+
84+
# or use color data for each cell:
85+
c=0.95 * colors,
86+
87+
# all cells will have the same shape and size:
88+
geom="ParallelepipedsConstSize"
89+
)
90+
91+
rt.show()
92+
93+
print("done")
94+
95+
if __name__ == '__main__':
96+
main()

0 commit comments

Comments
 (0)