mirror of
https://github.com/blender/blender
synced 2026-11-22 03:45:13 +03:00
`Eavg` can still be 1 for very small roughness, causing division by zero when computing `Ems`. A roughness of 1e-5 gives an `Evg` of 0.999998, seems reasonable. Pull Request: https://projects.blender.org/blender/blender/pulls/143637
16 lines
468 B
Text
16 lines
468 B
Text
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
|
|
|
#include "stdcycles.h"
|
|
|
|
shader node_diffuse_bsdf(color Color = 0.8,
|
|
float Roughness = 0.0,
|
|
normal Normal = N,
|
|
output closure color BSDF = 0)
|
|
{
|
|
if (Roughness < 1e-5)
|
|
BSDF = Color * diffuse(Normal);
|
|
else
|
|
BSDF = oren_nayar_diffuse_bsdf(Normal, clamp(Color, 0.0, 1.0), Roughness);
|
|
}
|