Refactor: Cycles: use anisotropic_vdf() in OSL principled volume

`henyey_greenstein()` and `absorption()` are deprecated in OSL new
versions, use `anisotropic_vdf()` instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/158772
This commit is contained in:
Weizhen Huang 2026-05-18 17:59:22 +02:00 • committed by Gitea
parent a55b783f47
commit b962d12de4

View file

@ -2,6 +2,7 @@
*
* SPDX-License-Identifier: Apache-2.0 */
#include "node_math.h"
#include "stdcycles.h"
shader node_principled_volume(color Color = color(0.5, 0.5, 0.5),
@ -37,11 +38,11 @@ shader node_principled_volume(color Color = color(0.5, 0.5, 0.5),
}
/* Add scattering and absorption closures. */
color scatter_coeff = scatter_color;
color absorption_color = sqrt(max(AbsorptionColor, 0.0));
color absorption_coeff = max(1.0 - scatter_color, 0.0) * max(1.0 - absorption_color, 0.0);
Volume = scatter_coeff * density * henyey_greenstein(Anisotropy) +
absorption_coeff * density * absorption();
color extinction = scatter_color + absorption_coeff;
color albedo = safe_divide(scatter_color, extinction);
Volume = density * anisotropic_vdf(albedo, extinction, Anisotropy);
}
/* Compute emission. */