blender/intern/cycles/kernel/osl/shaders/node_volume_coefficients.osl
Alexandre-Cardaillac 921c2b9d61 Shader: New Volume Coefficients Shader
Add a new shader node to control volume coefficients (scattering,
absorption and emission) directly, making it easier to model existing
volumes with measured data.

Pull Request: https://projects.blender.org/blender/blender/pulls/136287
2025-05-08 19:19:35 +02:00

26 lines
1.1 KiB
Text

/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#include "node_scatter.h"
shader node_volume_coefficients(string phase = "Henyey-Greenstein",
vector AbsorptionCoefficients = vector(1.0, 1.0, 1.0),
vector ScatterCoefficients = vector(1.0, 1.0, 1.0),
float Anisotropy = 0.0,
float IOR = 1.33,
float Backscatter = 0.1,
float Alpha = 0.5,
float Diameter = 20.0,
vector EmissionCoefficients = vector(0.0, 0.0, 0.0),
output closure color Volume = 0)
{
closure color scatter_closure = scatter(phase, Anisotropy, IOR, Backscatter, Alpha, Diameter);
/* Add scattering and absorption closures. */
Volume = color(ScatterCoefficients) * scatter_closure +
color(AbsorptionCoefficients) * absorption();
/* Compute emission. */
Volume += color(EmissionCoefficients) * emission();
}