mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
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:
parent
a55b783f47
commit
b962d12de4
1 changed files with 4 additions and 3 deletions
|
|
@ -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. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue