Fix T39284: clamp cycles volume density to be >= 0, to avoid accidental strange shading.
This commit is contained in:
parent
97881d06b2
commit
72308669ce
Notes:
blender-bot
2023-02-14 10:57:54 +01:00
Referenced by issue #39284, Cycles: Volume Absorption node emit light with negative Density value.
|
@ -21,6 +21,6 @@ shader node_absorption_volume(
|
|||
float Density = 1.0,
|
||||
output closure color Volume = 0)
|
||||
{
|
||||
Volume = ((color(1.0, 1.0, 1.0) - Color) * Density) * absorption();
|
||||
Volume = ((color(1.0, 1.0, 1.0) - Color) * max(Density, 0.0)) * absorption();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,6 @@ shader node_scatter_volume(
|
|||
float Anisotropy = 0.0,
|
||||
output closure color Volume = 0)
|
||||
{
|
||||
Volume = (Color * Density) * henyey_greenstein(Anisotropy);
|
||||
Volume = (Color * max(Density, 0.0)) * henyey_greenstein(Anisotropy);
|
||||
}
|
||||
|
||||
|
|
|
@ -498,7 +498,7 @@ ccl_device void svm_node_closure_volume(KernelGlobals *kg, ShaderData *sd, float
|
|||
|
||||
float param1 = (stack_valid(param1_offset))? stack_load_float(stack, param1_offset): __uint_as_float(node.z);
|
||||
float param2 = (stack_valid(param2_offset))? stack_load_float(stack, param2_offset): __uint_as_float(node.w);
|
||||
float density = param1;
|
||||
float density = fmaxf(param1, 0.0f);
|
||||
|
||||
switch(type) {
|
||||
case CLOSURE_VOLUME_ABSORPTION_ID: {
|
||||
|
|
Loading…
Reference in New Issue