PlotOptiX:基于NVIDIA OptiX光线跟踪框架的Python数据可视化

网友投稿 1380 2022-10-31

PlotOptiX:基于NVIDIA OptiX光线跟踪框架的Python数据可视化

PlotOptiX:基于NVIDIA OptiX光线跟踪框架的Python数据可视化

PlotOptiX

Data visualisation in Python based on NVIDIA OptiX ray tracing framework.

Note: active development is continuing, expect changes.

3D ray tracing package for Python, aimed at easy and aesthetic visualization of large datasets (and small as well). Data features can be represented on plots as a position, size/thickness and color of markers of several basic shapes, or projected onto the surfaces of objects in form of a color textures and displacement maps. All finished with a photorealistic lighting and depth of field.

No need to write shaders, intersection algorithms, handle 3D scene technicalities. Basic usage is even more simple than with matplotlib:

import numpy as npfrom plotoptix import TkOptiXn = 1000000 # 1M points, better not try this with matplotlibxyz = 3 * (np.random.random((n, 3)) - 0.5) # random 3D positionsr = 0.02 * np.random.random(n) + 0.002 # random radiiplot = TkOptiX()plot.set_data("my plot", xyz, r=r)plot.show()

... but PlotOptiX is much faster on large data and, with all the raytraced shades and DoF, more readable and eye catching.

Documentation pages are currently generated from the source code docstrings. Please, see examples on GitHub for practical code samples.

PlotOptiX is based on NVIDIA OptiX framework wrapped in RnD.SharpOptiX C#/C++ libraries and completed with custom CUDA shaders by R&D Team. PlotOptiX makes use of RTX-capable GPU's.

Features

progressive path tracing with explicit light samplingpinhole cameras and cameras with depth of field simulationgeometries: particle (sphere), parallelepiped, parallelogram, tetrahedron, bezier line, surface meshparameterized materials shading: flat, diffuse, reflective, refractive (including light dispersion and nested volumes)spherical and parallelogram light sourcesenvironmental light and ambient occlusionpost-processing: tonal correction curves, levels adjustment, apply mask/overlay, AI denoiserGPU acceleration using RT Cores, multi-GPU support, and everything else what comes with OptiX 6.0callbacks at the scene initialization, start and end of each frame raytracing, end of progressive accumulationimage output to numpy array, or save to popular image file formatshardware accelerated video output to MP4 file format using NVENC 9.0Tkinter based UI or headless raytracer

System Requirements

a CUDA-enabled GPU with compute capability 5.0 (Maxwell) to latest (Turing)Python 3 64-bit Windows: .NET Framework >= 4.6.1 (present in normally updated Windows) Linux: Mono Common Language Runtime >= 5.2, recommended: 5.20.1pythonnet >= 2.4FFmpeg >= 4.1 for video encoding: CUDA Toolkit v10.x (tested with v10.0 and v10.1)

What's Included

OptiX 6.0.0 librariesRnD.SharpOptiX and RnD.SharpEncoder librariesall other supporting 3'rd party libraries: FFmpeg (Windows only), LibTiff, Newtonsoft.JsonPython examples

Installation

GPU drivers note: seems that problems are gone with the recent NVIDIA driver updates but if you experience problems with drivers release 430/431 then drivers 419 (Windows) and 418 (Ubuntu, CentOS) are recommended.

Note, at this point, PlotOptiX binaries are tested in: Windows 10, Ubuntu 18.04, CentOS 7.

PlotOptiX was also successfully tested on the Google Cloud Platform, using Compute Engine instance with 2x V100 GPU's and Ubuntu 18.04 image. Here are the installation steps so you can save some precious seconds (FFmpeg not included).

Windows should be ready to go in most cases. You need to do some more typing in Linux. For video encoding you need to install CUDA toolkit in both Linux and Windows.

Windows prerequisites

.NET Framework:

Most likely you already got the right version with your Windows installation. Just in case, here is the command verifying this:

C:\>reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\full" /v versionHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\full version REG_SZ 4.7.03056

If the number in your output is < 4.6.1, visit download page and install the most recent release.

Linux prerequisites

Mono runtime:

Check if / which Mono release is present in your system:

mono -VMono JIT compiler version 5.18.1.3 (tarball Tue Apr 9 16:16:30 UTC 2019) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. mono-project.com TLS: __thread ... (output cropped for clarity) ...

If mono command is not available, or the reported version is < 5.2, visit Mono download page and follow instructions related to your Linux distribution. You want to install mono-complete package.

Note: pythonnet 2.4.0 is not compatible with Mono 6.0; install Mono 5.20.1 instead:

apt -y install gnupg ca-certificatesapt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EFecho "deb https://download.mono-project.com/repo/ubuntu stable-bionic/snapshots/5.20.1 main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.listapt updateapt -y install mono-complete

pythonnet:

The pythonnet package is available from PyPI, however, some prerequisities are needed. Instuctions below are based on APT, replace apt with yum depending on your OS:

apt updateapt install clang libglib2.0-dev python-dev

You may also need to install development tools, if not already present in your system, e.g. in Ubuntu:

apt install build-essential

or in CentOS:

yum group install "Development Tools"

Then, update required packages and install pythonnet:

pip install -U setuptools wheel pycparserpip install -U pythonnet

After successful installation you should be able to do python's import:

import clrprint(clr.__version__)

FFmpeg:

FFmpeg shared libraries >= 4.1 are required to enable video encoding features in PlotOptiX. Uninstall older version first. Visit FFmpeg site and download the most recent release sources. Unpack it to a new folder, cd to it. Configure, compile and install as below:

./configure --enable-sharedmakesudo make install

Add FFmpeg's shared library path to your config:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/libsudo ldconfig

CUDA Toolkit

CUDA libraries are not included in the package and required only for the video encoding features of PlotOptiX. Visit CUDA download page, select your operating system and CUDA version 10.x. Download and run the installer.

Linux note: Install the GPU driver before installing CUDA toolkit, it makes things easier.

PlotOptiX

Using pip:

pip install -U plotoptix

From GitHub sources:

git clone https://github.com/rnd-team-dev/plotoptix.gitcd plotoptixpython setup.py install

Then, try running code from the top of this readme, or one of the examples. You may also need to install tkinter and/or PyQt packages, if not shipped with your Python environment.

Denoiser binaries are optional and can be downloaded after PlotOptiX installation (the package size is ~370 MB, administrator rights are required for the installation):

python -m plotoptix.install denoiser

Development path

This is an early version. There are some important features not available yet, eg. ticks and labels on plot axes.

PlotOptiX is basically an interface to RnD.SharpOptiX library which we are developing and using in our Studio. RnD.SharpOptiX offers much more functionality than it is now available through PlotOptiX. We'll progressively add more to PlotOptiX if there is interest in this project (download, star, and support if you like it!).

The idea for development is:

Binaries for Linux (done in v0.3.0). Complete the plot layout / cover more raytracing features. Convenience functions for various plot styles. Other GUI's. Here, the community input is possible and warmly welcome!

Examples

Looking at examples is the best way to get started and explore PlotOptiX features. Have a look at the readme and sample codes here.

Examples in the repository head may use features not yet available in the PyPI release. In order to download examples compatible with PyPI release install the package:

python -m plotoptix.install examples

This will create a folder with examples in the current directory.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:doctest - 最轻的特性丰富的C++单个header的测试框架
下一篇:modern-server:包含HTTP/2和Let's Encrypt的基本Web服务器框架
相关文章

 发表评论

暂时没有评论,来抢沙发吧~