GPU渲染

GPU 渲染能够使用你的显卡进行渲染,而不是CPU。这会加快渲染速度,因为如今GPU的设计旨在能够胜任大量运算方面的应用。另一方面,由于显存容量有限,它们在渲染复杂场景时也有一些限制,并且在使用相同的显卡进行显示和渲染时会出现交互性问题。

要启用GPU渲染,请进入 首选项 ‣ 系统 ‣ Cycles渲染设备 ,然后选择 CUDAOptixOpenCL 。接下来,您必须为每个场景设置以下步骤才能使用GPU渲染 属性 ‣ 渲染 ‣ 设备

Note

GPU rendering is only supported on Windows and Linux; macOS is currently not supported.

支持的硬件

Blender支持两种不同的技术在GPU上渲染,具体取决于特定的GPU制造商。

NVIDIA 英伟达

支持使用 NVIDIA 显卡进行GPU渲染的 CUDA 和Optix。

CUDA

CUDA requires graphics cards with compute capability 3.0 and higher. To make sure your GPU is supported, see the list of Nvidia graphics cards with the compute capabilities and supported graphics cards.

OptiX

OptiX requires graphics cards with compute capability 5.0 and higher. To make sure your GPU is supported, see the list of Nvidia graphics cards OptiX works best on RTX graphics cards with hardware ray tracing support (e.g. Turing and above). OptiX support is still experimental and does not yet support all features, see below for details.

OptiX requires Geforce or Quadro RTX graphics card with recent Nvidia drivers.

AMD

OpenCL is supported for GPU rendering with AMD graphics cards. Blender supports graphics cards with GCN generation 2 and above. To make sure your GPU is supported, see the list of GCN generations with the GCN generation and supported graphics cards.

On Windows and Linux, the latest Pro drivers should be installed from the AMD website.

支持特性和限制

CUDA和OpenCL渲染支持与CPU渲染相同的所有功能,但以下两项除外:

  • 开放着色语言。

  • 高级的体积光采样以降低噪点。

Optix支持是实验性的,尚不支持以下功能:

  • 烘焙

  • 分路路径追踪

  • 环境光遮蔽(AO)和倒角着色器节点

  • 结合CPU + GPU渲染

常见问题

为什么在渲染过程中Blender没有反应?

显卡正在渲染时,它不能重新绘制用户界面,这会导致Blender无法响应。我们试图通过尽可能频繁地回馈GPU控制来避免这个问题,但是无法保证完全流畅的交互,特别是在复杂的场景中。这是显卡没有真正解决方案的限制,尽管我们可能在未来有所改进。

如果可能的话,最好配备多个GPU,其中的一个用于显示界面,另一个用于渲染。

为什么场景是通过CPU渲染的,而不是GPU?

There maybe be multiple causes, but the most common one is that there is not enough memory on your graphics card. Typically, the GPU can only use the amount of memory that is on the GPU (see below for more information). This is usually much smaller than the amount of system memory the CPU can access. With CUDA and OptiX devices, if the GPU memory is full Blender will automatically try to use system memory. This has a performance impact, but will usually still result in a faster render than using CPU rendering. This feature does not work for OpenCL rendering.

多个GPU可以用于渲染吗?

可以。打开 用户设置 ‣ 系统 ‣ 计算设备面板 ,按需进行设置即可。

多个GPU能够增加显存容量吗?

Typically, no, each GPU can only access its own memory, however, some GPUs can share their memory. This is can be enabled with Distributed Memory Across Devices.

哪种渲染方案更为快速?NVIDIA还是AMD?CUDA还是OpenCL?

取决于所使用的硬件。根据测试场景,不同的技术所需的计算时间也有差异。有关不同设备性能的最新信息,请浏览 Blender Open Data

报错信息

如果出现问题,请确保从NVIDIA或AMD网站来安装官方显卡驱动程序,或者通过Linux上的软件包管理器来安装。

不支持的GNU版本!不支持gcc 4.5及以上版本!

在Linux系统下,根据你的GCC版本,你可能会收到此错误。有两种可能的解决方案:

使用备用编译器

如果安装了与安装的CUDA工具包版本兼容的较旧GCC,则可以使用它而不是默认编译器。这是通过在启动Blender时设置 CYCLES_CUDA_EXTRA_CFLAGS 环境变量来完成的。

从命令行启动Blender,如下所示:

CYCLES_CUDA_EXTRA_CFLAGS="-ccbin gcc-x.x" blender

(替换兼容GCC编译器的名称或路径)。

删除兼容性检查

如果以上方法都不管用,在 /usr/local/cuda/include/host_config.h 中删除如下行内容即可

#error -- unsupported GNU version! gcc 4.7 and up are not supported!

这将允许Cycles在第一次尝试使用GPU进行渲染时成功编译CUDA渲染内核。成功构建内核后,你可以像往常一样启动Blender,CUDA内核仍将用于渲染。

CUDA错误:无效的内核图像

如果您在Windows 64位系统下遇到此错误信息,请务必使用64位的Blender版本,而不要使用32位版本。

CUDA错误:内核编译失败

如果您有新的Nvidia显卡尚未支持您安装的Blender版本和CUDA工具包,则可能会出现此错误。在这种情况下,Blender可能会尝试为您的图形卡动态构建内核并失败。

在这种情况下,您可以:

  1. Check if the latest Blender version (official or experimental builds) supports your graphics card.

  2. 如果您自己构建Blender,请尝试下载并安装更新的CUDA开发人员工具包。

通常用户不需要安装CUDA工具箱,因为Blender带有预编译的内核。

CUDA错误:内存不足

这通常意味着GPU没有足够的显存来储存场景。

Note

使用较小的纹理分辨率是减少内存使用量的一种方法。比如,8k、4k、2k 和 1k 图像纹理分别占 256MB、64MB、16MB 和 4MB 的内存。

NVIDIA OpenGL驱动与显示驱动程序失去连接

如果同时使用GPU来显示与渲染,Windows系统在GPU渲染计算时间方面存在局限。如果您的场景非常复杂,那么Cycles引擎就需要占用过多的GPU时间。通过降低性能面板中的平铺尺寸值可以让此问题得到缓解,但真正的解决方案只有使用多个相对独立的显卡分别进行界面显示与渲染。

Another solution can be to increase the time-out, although this will make the user interface less responsive when rendering heavy scenes. Learn More Here.

CUDA 错误: 在 cuCtxSynchronize() 中的未知错误

一个未知的错误可能有很多原因,但有一种可能性是它超时。请参阅上述答案以获取解决方案。