VTK使用NVIDIA RTX添加gpu加速射线跟踪

原文url:https://blog.kitware.com/paraview-and-vtk-add-gpu-accelerated-ray-tracing-with-nvidia-rtx/

ParaView and VTK add GPU-accelerated ray tracing with NVIDIA RTX

One of the many cool new features to look forward to in the upcoming ParaView 5.7 and VTK 9.0 releases is the seamless support for hardware-accelerated ray tracing using OptiX, a component of the NVIDIA RTX platform.

即将发布的ParaView 5.7和VTK 9.0版本中有许多很酷的新特性,其中之一就是使用OptiX (NVIDIA RTX平台的一个组件)无缝支持硬件加速射线跟踪。

ParaView accelerated by the latest-generation GPUs, especially with the RT Cores devoted to ray tracing found on NVIDIA’s Turing GPUs, brings a wide range of benefits to scientific visualization. Far beyond making pretty pictures for publication and outreach, the resulting photo-realism can in some cases be used for direct comparisons between simulation output and observations.

最新一代gpu加速了ParaView,特别是在NVIDIA的Turing gpu上发现的用于射线追踪的RT核心,为科学可视化带来了广泛的好处。除了制作可供发表和推广的漂亮图片,生成的照片真实感在某些情况下还可用于直接比较模拟输出和观察结果。

In others, the visual cues obtained by the physically based rendering process, including shadows, ambient occlusion, or even depth-of-field effects, can help to better understand the spatial relationship of the objects in the scene. This visual fidelity comes with a significant computational cost, but modern GPUs make it possible to perform this process in real time.

在另一些场景中,通过基于物理的渲染过程获得的视觉线索,包括阴影、环境遮挡、甚至景深效果,可以帮助更好地理解场景中对象的空间关系。这种视觉逼真度带来了巨大的计算成本,但现代gpu使实时执行这一过程成为可能。

To explore these features, simply download the upcoming ParaView 5.7.0 release candidate 2 (or later) from paraview.org and launch it. Make sure you set the “–enable-streaming” command line flag to allow the visuals to improve over time while maintaining a high degree of interactivity.

要探索这些特性,只需从paraview.org下载即将发布的ParaView 5.7.0候选版本2(或更新版本)并启动它。确保您设置了“-enable-streaming”命令行标志,以允许视觉效果随着时间的推移而改善,同时保持高度的交互性。
在这里插入图片描述
Then set up your visualization pipeline as you typically do in ParaView. In the properties menu, select the “Enable Ray Tracing” check box (typically at the very bottom) as well as the “OptiX Path Tracer” backend. If the default value for progressive passes is a bit too low, make sure you set it to some value above 4.

然后像在ParaView中一样设置可视化管道。在属性菜单中,选择“启用射线跟踪”复选框(通常在最下面)以及“OptiX路径跟踪器”后端。如果渐进传递的默认值太低,请确保将其设置为大于4的值。
在这里插入图片描述
From here on you’re ready to explore the RTX backend, provided you’re on a Pascal generation or newer GPU. Make sure you use the Light Inspector to set the proper light sources, including area lights for soft shadows. Experiment with materials from the provided list of pre-set materials, or define them with your own materials library. With the Material Definition Language (MDL) [https://developer.nvidia.com/mdl-sdk] being an integral part of RTX, you can now choose from an almost infinite collection of materials. And with the Adjust Camera panel, you can set the camera properties, including focal point and depth of field.

从这里开始,您已经准备好探索RTX后端,前提是您使用的是Pascal一代或更新的GPU。确保使用灯光检查器设置合适的光源,包括柔和阴影的区域灯光。使用预先设置的材料列表中的材料进行试验,或者使用您自己的材料库定义它们。由于材料定义语言(Material Definition Language, MDL) [https://developer.nvidia.com/mdl-sdk]是RTX不可分割的一部分,您现在可以从几乎无限的材料集合中进行选择。通过调整相机面板,你可以设置相机属性,包括焦点和景深。
在这里插入图片描述
The iconic OpenFoam Motorbike, rendered with the OptiX path tracer in ParaView. Realistic materials, shadows and depth of field help to guide the viewer to the interesting part of the visualization — the turbulence around the front wheel — while providing context to convey spatial relationships.

标志性的OpenFoam摩托车,呈现与OptiX路径跟踪在ParaView。真实的材料,阴影和景深有助于引导观众到可视化的有趣部分——前轮周围的湍流——同时提供环境来传达空间关系。

To get more details, check out the recording of the ParaView/OptiX webinar [https://info.nvidia.com/ray-tracing-for-scientific-visualization-reg-page.html?ncid=em-ded-n1-84042]. Also, note that the renderer is integrated at the VTK level, and all these features are available within VTK as well. And, like all the other VTK or ParaView features, RTX rendering is exposed via the C++ API, as well as via Python.

要了解更多细节,请查看ParaView/OptiX webinar的记录[https://info.nvidia.com/ray-tracing-for-scientific-visualization-reg-page.html?ncid=em-ded-n1-84042]。另外,请注意渲染器是在VTK级别集成的,而且所有这些特性在VTK中也可用。而且,与所有其他VTK或ParaView特性一样,RTX呈现是通过c++ API和Python公开的。

The above focuses on just one of the new features in the latest release of ParaView and VTK. For all the other new and improved features of ParaView 5.7, including the improved plugin for the IndeX volume renderer [https://www.nvidia.com/en-us/data-center/index-paraview-plugin/], check out the release notes.

以上重点介绍了ParaView和VTK最新版本中的一个新特性。对于所有其他新的和改进的ParaView 5.7特性,包括索引卷渲染器的改进插件[https://www.nvidia.com/en-us/data/index-paraview-plugin/],请查看发布说明。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
VTK可以使用显卡加速来提高渲染性能和显示质量,具体方法如下: 1. 使用OpenGL渲染器 VTK默认使用OpenGL渲染器,可以通过设置vtkRenderWindow的SetMultiSamples()方法来启用多重采样,以提高渲染质量。例如: ```python import vtk renderer = vtk.vtkRenderer() renderWindow = vtk.vtkRenderWindow() renderWindow.SetMultiSamples(4) # 启用4倍多重采样 renderWindow.AddRenderer(renderer) ``` 2. 使用GPU加速vtkOpenGLRenderer 除了默认的OpenGL渲染器外,VTK还提供了基于GPU加速vtkOpenGLRenderer,可以显著提高渲染性能和显示质量。可以通过以下代码来创建vtkOpenGLRenderer: ```python import vtk renderer = vtk.vtkRenderer() renderWindow = vtk.vtkRenderWindow() # 创建vtkOpenGLRenderer对象 openGLRenderer = vtk.vtkOpenGLRenderer() openGLRenderer.SetRenderWindow(renderWindow) renderWindow.AddRenderer(openGLRenderer) # 将vtkRenderer对象添加vtkOpenGLRenderer对象中 openGLRenderer.AddActor(actor) ``` 3. 使用OpenGL扩展 VTK还提供了一些OpenGL扩展,可以使用GPU加速一些高级渲染功能,例如体绘制、阴影和透明度等。可以通过以下代码来启用OpenGL扩展: ```python import vtk renderer = vtk.vtkRenderer() renderWindow = vtk.vtkRenderWindow() # 启用OpenGL扩展 vtkOpenGLExtensionManager = vtk.vtkOpenGLExtensionManager() vtkOpenGLExtensionManager.SetRenderWindow(renderWindow) vtkOpenGLExtensionManager.Update() renderWindow.AddRenderer(renderer) ``` 需要注意的是,使用显卡加速可能会增加程序的硬件要求,并且可能会导致一些兼容性问题。因此,在使用显卡加速时,需要根据具体情况选择合适的渲染方式,并进行适当的测试和优化。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

努力减肥的小胖子5

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值