Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-05-17 17:27:37 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-05-17 17:46:37 +0300
commit8fdd3aad9bd8bd463b9b792f0d9063c2330aadfa (patch)
treea055b758cfd4a8ff8e7948cb9574879740a75bb6 /intern/cycles/kernel/osl/closures.cpp
parent0609b4bb491eae28b7aff411f54d732b458d6ae9 (diff)
Fix T98163: Cycles OSL rendering normal maps differently
Match SVM and ensure valid reflection when setting up BSDFs.
Diffstat (limited to 'intern/cycles/kernel/osl/closures.cpp')
-rw-r--r--intern/cycles/kernel/osl/closures.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/intern/cycles/kernel/osl/closures.cpp b/intern/cycles/kernel/osl/closures.cpp
index 06b91ab9bb7..7c6b48154e4 100644
--- a/intern/cycles/kernel/osl/closures.cpp
+++ b/intern/cycles/kernel/osl/closures.cpp
@@ -180,6 +180,8 @@ class PrincipledSheenClosure : public CBSDFClosure {
void setup(ShaderData *sd, uint32_t path_flag, float3 weight)
{
if (!skip(sd, path_flag, LABEL_DIFFUSE)) {
+ params.N = ensure_valid_reflection(sd->Ng, sd->I, params.N);
+
PrincipledSheenBsdf *bsdf = (PrincipledSheenBsdf *)bsdf_alloc_osl(
sd, sizeof(PrincipledSheenBsdf), weight, &params);
sd->flag |= (bsdf) ? bsdf_principled_sheen_setup(sd, bsdf) : 0;
@@ -223,6 +225,8 @@ class PrincipledHairClosure : public CBSDFClosure {
void setup(ShaderData *sd, uint32_t path_flag, float3 weight)
{
if (!skip(sd, path_flag, LABEL_GLOSSY)) {
+ params.N = ensure_valid_reflection(sd->Ng, sd->I, params.N);
+
PrincipledHairBSDF *bsdf = (PrincipledHairBSDF *)alloc(sd, path_flag, weight);
if (!bsdf) {
return;
@@ -282,6 +286,7 @@ class PrincipledClearcoatClosure : public CBSDFClosure {
void setup(ShaderData *sd, uint32_t path_flag, float3 weight)
{
+ params.N = ensure_valid_reflection(sd->Ng, sd->I, params.N);
MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
@@ -503,6 +508,8 @@ class MicrofacetClosure : public CBSDFClosure {
return;
}
+ params.N = ensure_valid_reflection(sd->Ng, sd->I, params.N);
+
MicrofacetBsdf *bsdf = (MicrofacetBsdf *)bsdf_alloc_osl(
sd, sizeof(MicrofacetBsdf), weight, &params);
@@ -601,6 +608,8 @@ class MicrofacetGGXFresnelClosure : public MicrofacetFresnelClosure {
public:
void setup(ShaderData *sd, uint32_t path_flag, float3 weight)
{
+ params.N = ensure_valid_reflection(sd->Ng, sd->I, params.N);
+
MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
@@ -630,6 +639,8 @@ class MicrofacetGGXAnisoFresnelClosure : public MicrofacetFresnelClosure {
public:
void setup(ShaderData *sd, uint32_t path_flag, float3 weight)
{
+ params.N = ensure_valid_reflection(sd->Ng, sd->I, params.N);
+
MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
@@ -695,6 +706,8 @@ class MicrofacetMultiGGXClosure : public MicrofacetMultiClosure {
public:
void setup(ShaderData *sd, uint32_t path_flag, float3 weight)
{
+ params.N = ensure_valid_reflection(sd->Ng, sd->I, params.N);
+
MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
@@ -723,6 +736,8 @@ class MicrofacetMultiGGXAnisoClosure : public MicrofacetMultiClosure {
public:
void setup(ShaderData *sd, uint32_t path_flag, float3 weight)
{
+ params.N = ensure_valid_reflection(sd->Ng, sd->I, params.N);
+
MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
@@ -755,6 +770,8 @@ class MicrofacetMultiGGXGlassClosure : public MicrofacetMultiClosure {
void setup(ShaderData *sd, uint32_t path_flag, float3 weight)
{
+ params.N = ensure_valid_reflection(sd->Ng, sd->I, params.N);
+
MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
@@ -819,6 +836,8 @@ class MicrofacetMultiGGXFresnelClosure : public MicrofacetMultiFresnelClosure {
public:
void setup(ShaderData *sd, uint32_t path_flag, float3 weight)
{
+ params.N = ensure_valid_reflection(sd->Ng, sd->I, params.N);
+
MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
@@ -849,6 +868,8 @@ class MicrofacetMultiGGXAnisoFresnelClosure : public MicrofacetMultiFresnelClosu
public:
void setup(ShaderData *sd, uint32_t path_flag, float3 weight)
{
+ params.N = ensure_valid_reflection(sd->Ng, sd->I, params.N);
+
MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
@@ -883,6 +904,8 @@ class MicrofacetMultiGGXGlassFresnelClosure : public MicrofacetMultiFresnelClosu
void setup(ShaderData *sd, uint32_t path_flag, float3 weight)
{
+ params.N = ensure_valid_reflection(sd->Ng, sd->I, params.N);
+
MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;