Volumes

Визуализация объёма может использоваться для отрисовки эффектов огня, дыма, тумана, поглощения в стекле, а также для многих других, которые не могут быть реализованы только шейдерами поверхности полисеток.

Для настройки объёма необходимо создать полисетку, которая будет определять границы будущего объёма. В материале вы, как правило, будете удалять все узлы шейдеров поверхности и вместо них добавлять узлы шейдеров объёма, чтобы определить затенение внутри объёма. Для таких эффектов, как поглощение в стекле вы будете использовать оба типа шейдеров - и поверхности, и объёма. Мир также может использовать шейдер объёма для создания, например, эффекта тумана.

Shading

Principled Volume

Principled Volume is a physically-based volume shader that can be used to create a wide range of volume materials. It supports scattering, absorption and emission in one easy to use node. Fire can be rendered with blackbody emission.

../../../_images/render_materials_components_volume_principled.jpg

Smoke and fire rendered with Principled Volume shader.

Volume Components

For more control, volume shading components can be manually combined into a custom shader setup.

  • Volume Absorption will absorb part of the light as it passes through the volume. This can be used to shade for example black smoke or colored glass objects, or mixed with the volume scatter node. This node is similar to the transparent BSDF node, it blocks part of the light and lets other light pass straight through.
  • Volume Scatter lets light scatter in other directions as it hits particles in the volume. The anisotropy defines in which direction the light is more likely to scatter. A value of 0 will let light scatter evenly in all directions (similar to the diffuse BSDF node), negative values let light scatter mostly backwards, and positive values let light scatter mostly forward. This can be used to shade white smoke or clouds for example.
  • Emission will emit light from the volume, for example for fire.
../../../_images/render_materials_components_volume_node.jpg

Volume Absorption, Scatter and Emission

Attributes

When rendering smoke and fire, volume attributes are used to define the shape and shading of the volume. The Principled Volume shader will use them by default, while custom volume shaders can use the Attribute node to get attributes such as density, color and temperature.

Плотность

Все шейдеры объёма имеют входной сокет плотности. Плотность определяет, сколько света провзаимодействует с объёмом, будет поглощено или рассеяно, а сколько пройдёт мимо. Для таких эффектов, как дым, вы могли бы определить поле плотности, указывающее, в каком месте объёма и в какой концентрации присутствует дым (плотность больше нуля), а в какой области его нет (плотность равна нулю).

Volumes in the real world consist of particles, a higher density means there are more particles per unit volume. More particles means there is a higher chance for light to collide with a particle and get absorbed or scattered, rather than passing straight through.

Mesh Volumes

Полисетки, используемые для визуализации объёма должны быть замкнутыми и развёртываемыми. Это значит, что в них не должно быть дырок. Каждое ребро должно соединять ровно две грани, так, чтобы не образовывалось дырок или Т-образных соединений граней, когда с ребром соединено три грани или более.

Для получения корректного результата нормали должны указывать наружу полисетки. Нормали используются для определения того, входит или выходит луч из объёма и если они указывают в неправильном направлении или в полисетке присутствуют дыры, то рендер не может определить, где у объёма внутренняя область, а где наружная.

Те же самые правила справедливы для корректной визуализации преломления в стекле.

World Volume

A volume shader can also be applied to the world, filling the entire space.

Currently, this is most useful for night time or other dark scenes, as the world surface shader or sun lights will have no effect if a volume shader is used. This is because the world background is assumed to be infinitely far away, which is accurate enough for the sun for example. However, for modeling effects such as fog or atmospheric scattering, it is not a good assumption that the volume fills the entire space, as most of the distance between the sun and the earth is empty space. For such effects it is be better to create a volume object surrounding the scene. The size of this object will determine how much light is scattered or absorbed.

Multiple Scattering

Real-world effects such as scattering in clouds or subsurface scattering require many scattering bounces. However, unbiased rendering of such effects can be noisy, so by default the number of bounces is zero in Cycles, and no support is available in Eevee. The effect you get when rendering with zero volume bounces is what is known as «single scattering», the effect from more bounces is «multiple scattering».

For rendering materials like skin or milk that require multiple scattering, subsurface scattering is more efficient and easier to control. Particularly the random walk method can accurately render such materials.

При визуализации таких материалов, как облака или дым, у которых нет чёткой границы, требуется визуализация объёма. Она выглядит лучше при использовании большого количества отскоков рассеивания, но на практике их количество нужно ограничивать, чтобы время визуализации оставалось в разумных пределах.