mirror of
https://github.com/blender/blender
synced 2026-10-25 03:07:01 +03:00
In Cycles we previously assumed that the IOR inversion, when hitting a surface from the backside, for dielectric closures (e.g., generalized_schlick, microfacet, refract, etc.) is done by the user in the OSL code. While experimenting with the OSL code generated by MaterialX and by looking at the example OSL shaders of the OSL testrender it shows that OSL assumes that this inversion is done implicitly, inside the closures. This change matches Cycles IOR inversion behavior with the one expected by MaterialX and OSL testrender. Pull Request: https://projects.blender.org/blender/blender/pulls/162634
18 lines
581 B
Text
18 lines
581 B
Text
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
|
|
|
#include "stdcycles.h"
|
|
|
|
shader node_refraction_bsdf(color Color = 0.8,
|
|
string distribution = "ggx",
|
|
float Roughness = 0.2,
|
|
float IOR = 1.45,
|
|
normal Normal = N,
|
|
output closure color BSDF = 0)
|
|
{
|
|
float eta = max(IOR, 1e-5);
|
|
float roughness = Roughness * Roughness;
|
|
|
|
BSDF = Color * microfacet(distribution, Normal, roughness, eta, 1);
|
|
}
|