Renamed the Disney BSDF to Principled BSDF.
This commit is contained in:
@@ -517,18 +517,18 @@ static ShaderNode *add_node(Scene *scene,
|
||||
}
|
||||
node = hair;
|
||||
}
|
||||
else if(b_node.is_a(&RNA_ShaderNodeBsdfDisney)) {
|
||||
BL::ShaderNodeBsdfDisney b_disney_node(b_node);
|
||||
DisneyBsdfNode *disney = new DisneyBsdfNode();
|
||||
switch (b_disney_node.distribution()) {
|
||||
case BL::ShaderNodeBsdfDisney::distribution_GGX:
|
||||
disney->distribution = CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID;
|
||||
else if(b_node.is_a(&RNA_ShaderNodeBsdfPrincipled)) {
|
||||
BL::ShaderNodeBsdfPrincipled b_principled_node(b_node);
|
||||
PrincipledBsdfNode *principled = new PrincipledBsdfNode();
|
||||
switch (b_principled_node.distribution()) {
|
||||
case BL::ShaderNodeBsdfPrincipled::distribution_GGX:
|
||||
principled->distribution = CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID;
|
||||
break;
|
||||
case BL::ShaderNodeBsdfDisney::distribution_MULTI_GGX:
|
||||
disney->distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID;
|
||||
case BL::ShaderNodeBsdfPrincipled::distribution_MULTI_GGX:
|
||||
principled->distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID;
|
||||
break;
|
||||
}
|
||||
node = disney;
|
||||
node = principled;
|
||||
}
|
||||
else if(b_node.is_a(&RNA_ShaderNodeBsdfTranslucent)) {
|
||||
node = new TranslucentBsdfNode();
|
||||
|
||||
@@ -108,8 +108,8 @@ set(SRC_CLOSURE_HEADERS
|
||||
closure/bssrdf.h
|
||||
closure/emissive.h
|
||||
closure/volume.h
|
||||
closure/bsdf_disney_diffuse.h
|
||||
closure/bsdf_disney_sheen.h
|
||||
closure/bsdf_principled_diffuse.h
|
||||
closure/bsdf_principled_sheen.h
|
||||
)
|
||||
|
||||
set(SRC_SVM_HEADERS
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
#include "../closure/bsdf_ashikhmin_shirley.h"
|
||||
#include "../closure/bsdf_toon.h"
|
||||
#include "../closure/bsdf_hair.h"
|
||||
#include "../closure/bsdf_disney_diffuse.h"
|
||||
#include "../closure/bsdf_disney_sheen.h"
|
||||
#include "../closure/bsdf_principled_diffuse.h"
|
||||
#include "../closure/bsdf_principled_sheen.h"
|
||||
#ifdef __SUBSURFACE__
|
||||
# include "../closure/bssrdf.h"
|
||||
#endif
|
||||
@@ -137,13 +137,13 @@ ccl_device_forceinline int bsdf_sample(KernelGlobals *kg,
|
||||
label = bsdf_hair_transmission_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DISNEY_DIFFUSE_ID:
|
||||
case CLOSURE_BSDF_BSSRDF_DISNEY_ID:
|
||||
label = bsdf_disney_diffuse_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID:
|
||||
case CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID:
|
||||
label = bsdf_principled_diffuse_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DISNEY_SHEEN_ID:
|
||||
label = bsdf_disney_sheen_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
case CLOSURE_BSDF_PRINCIPLED_SHEEN_ID:
|
||||
label = bsdf_principled_sheen_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
#endif
|
||||
@@ -243,12 +243,12 @@ float3 bsdf_eval(KernelGlobals *kg,
|
||||
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
|
||||
eval = bsdf_hair_transmission_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DISNEY_DIFFUSE_ID:
|
||||
case CLOSURE_BSDF_BSSRDF_DISNEY_ID:
|
||||
eval = bsdf_disney_diffuse_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID:
|
||||
case CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID:
|
||||
eval = bsdf_principled_diffuse_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DISNEY_SHEEN_ID:
|
||||
eval = bsdf_disney_sheen_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
case CLOSURE_BSDF_PRINCIPLED_SHEEN_ID:
|
||||
eval = bsdf_principled_sheen_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
break;
|
||||
#endif
|
||||
#ifdef __VOLUME__
|
||||
@@ -323,12 +323,12 @@ float3 bsdf_eval(KernelGlobals *kg,
|
||||
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
|
||||
eval = bsdf_hair_transmission_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DISNEY_DIFFUSE_ID:
|
||||
case CLOSURE_BSDF_BSSRDF_DISNEY_ID:
|
||||
eval = bsdf_disney_diffuse_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID:
|
||||
case CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID:
|
||||
eval = bsdf_principled_diffuse_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DISNEY_SHEEN_ID:
|
||||
eval = bsdf_disney_sheen_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
case CLOSURE_BSDF_PRINCIPLED_SHEEN_ID:
|
||||
eval = bsdf_principled_sheen_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
break;
|
||||
#endif
|
||||
#ifdef __VOLUME__
|
||||
|
||||
@@ -398,7 +398,7 @@ ccl_device float3 bsdf_microfacet_ggx_eval_reflect(const ShaderClosure *sc, cons
|
||||
float alpha2 = alpha_x * alpha_y;
|
||||
float D, G1o, G1i;
|
||||
|
||||
bool is_disney_clearcoat = (bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID);
|
||||
bool is_principled_clearcoat = (bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID);
|
||||
|
||||
if(alpha_x == alpha_y) {
|
||||
/* isotropic
|
||||
@@ -409,7 +409,7 @@ ccl_device float3 bsdf_microfacet_ggx_eval_reflect(const ShaderClosure *sc, cons
|
||||
float cosThetaM4 = cosThetaM2 * cosThetaM2;
|
||||
float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2;
|
||||
|
||||
if(is_disney_clearcoat) {
|
||||
if(is_principled_clearcoat) {
|
||||
/* use GTR1 for clearcoat */
|
||||
D = D_GTR1(cosThetaM, bsdf->alpha_x);
|
||||
|
||||
@@ -468,7 +468,7 @@ ccl_device float3 bsdf_microfacet_ggx_eval_reflect(const ShaderClosure *sc, cons
|
||||
float common = D * 0.25f / cosNO;
|
||||
|
||||
float3 F = reflection_color(bsdf, omega_in, m);
|
||||
if(is_disney_clearcoat) {
|
||||
if(is_principled_clearcoat) {
|
||||
F *= 0.25f * bsdf->extra->clearcoat;
|
||||
}
|
||||
|
||||
@@ -602,7 +602,7 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals *kg, const ShaderClosure
|
||||
float alpha2 = alpha_x * alpha_y;
|
||||
float D, G1i;
|
||||
|
||||
bool is_disney_clearcoat = (bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID);
|
||||
bool is_principled_clearcoat = (bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID);
|
||||
|
||||
if(alpha_x == alpha_y) {
|
||||
/* isotropic */
|
||||
@@ -613,7 +613,7 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals *kg, const ShaderClosure
|
||||
/* eval BRDF*cosNI */
|
||||
float cosNI = dot(N, *omega_in);
|
||||
|
||||
if(is_disney_clearcoat) {
|
||||
if(is_principled_clearcoat) {
|
||||
/* use GTR1 for clearcoat */
|
||||
D = D_GTR1(cosThetaM, bsdf->alpha_x);
|
||||
|
||||
@@ -662,7 +662,7 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals *kg, const ShaderClosure
|
||||
*pdf = common;
|
||||
|
||||
float3 F = reflection_color(bsdf, *omega_in, m);
|
||||
if(is_disney_clearcoat) {
|
||||
if(is_principled_clearcoat) {
|
||||
F *= 0.25f * bsdf->extra->clearcoat;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,24 +14,24 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __BSDF_DISNEY_DIFFUSE_H__
|
||||
#define __BSDF_DISNEY_DIFFUSE_H__
|
||||
#ifndef __BSDF_PRINCIPLED_DIFFUSE_H__
|
||||
#define __BSDF_PRINCIPLED_DIFFUSE_H__
|
||||
|
||||
/* DISNEY DIFFUSE BRDF
|
||||
/* DISNEY PRINCIPLED DIFFUSE BRDF
|
||||
*
|
||||
* Shading model by Brent Burley (Disney): "Physically Based Shading at Disney" (2012)
|
||||
*/
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
typedef ccl_addr_space struct DisneyDiffuseBsdf {
|
||||
typedef ccl_addr_space struct PrincipledDiffuseBsdf {
|
||||
SHADER_CLOSURE_BASE;
|
||||
|
||||
float roughness;
|
||||
float3 N;
|
||||
} DisneyDiffuseBsdf;
|
||||
} PrincipledDiffuseBsdf;
|
||||
|
||||
ccl_device float3 calculate_disney_diffuse_brdf(const DisneyDiffuseBsdf *bsdf,
|
||||
ccl_device float3 calculate_principled_diffuse_brdf(const PrincipledDiffuseBsdf *bsdf,
|
||||
float3 N, float3 V, float3 L, float3 H, float *pdf)
|
||||
{
|
||||
float NdotL = max(dot(N, L), 0.0f);
|
||||
@@ -53,16 +53,16 @@ ccl_device float3 calculate_disney_diffuse_brdf(const DisneyDiffuseBsdf *bsdf,
|
||||
return make_float3(value, value, value);
|
||||
}
|
||||
|
||||
ccl_device int bsdf_disney_diffuse_setup(DisneyDiffuseBsdf *bsdf)
|
||||
ccl_device int bsdf_principled_diffuse_setup(PrincipledDiffuseBsdf *bsdf)
|
||||
{
|
||||
bsdf->type = CLOSURE_BSDF_DISNEY_DIFFUSE_ID;
|
||||
bsdf->type = CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID;
|
||||
return SD_BSDF|SD_BSDF_HAS_EVAL;
|
||||
}
|
||||
|
||||
ccl_device float3 bsdf_disney_diffuse_eval_reflect(const ShaderClosure *sc, const float3 I,
|
||||
ccl_device float3 bsdf_principled_diffuse_eval_reflect(const ShaderClosure *sc, const float3 I,
|
||||
const float3 omega_in, float *pdf)
|
||||
{
|
||||
const DisneyDiffuseBsdf *bsdf = (const DisneyDiffuseBsdf *)sc;
|
||||
const PrincipledDiffuseBsdf *bsdf = (const PrincipledDiffuseBsdf *)sc;
|
||||
|
||||
float3 N = bsdf->N;
|
||||
float3 V = I; // outgoing
|
||||
@@ -71,7 +71,7 @@ ccl_device float3 bsdf_disney_diffuse_eval_reflect(const ShaderClosure *sc, cons
|
||||
|
||||
if(dot(N, omega_in) > 0.0f) {
|
||||
*pdf = fmaxf(dot(N, omega_in), 0.0f) * M_1_PI_F;
|
||||
return calculate_disney_diffuse_brdf(bsdf, N, V, L, H, pdf);
|
||||
return calculate_principled_diffuse_brdf(bsdf, N, V, L, H, pdf);
|
||||
}
|
||||
else {
|
||||
*pdf = 0.0f;
|
||||
@@ -79,18 +79,18 @@ ccl_device float3 bsdf_disney_diffuse_eval_reflect(const ShaderClosure *sc, cons
|
||||
}
|
||||
}
|
||||
|
||||
ccl_device float3 bsdf_disney_diffuse_eval_transmit(const ShaderClosure *sc, const float3 I,
|
||||
ccl_device float3 bsdf_principled_diffuse_eval_transmit(const ShaderClosure *sc, const float3 I,
|
||||
const float3 omega_in, float *pdf)
|
||||
{
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
ccl_device int bsdf_disney_diffuse_sample(const ShaderClosure *sc,
|
||||
ccl_device int bsdf_principled_diffuse_sample(const ShaderClosure *sc,
|
||||
float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv,
|
||||
float3 *eval, float3 *omega_in, float3 *domega_in_dx,
|
||||
float3 *domega_in_dy, float *pdf)
|
||||
{
|
||||
const DisneyDiffuseBsdf *bsdf = (const DisneyDiffuseBsdf *)sc;
|
||||
const PrincipledDiffuseBsdf *bsdf = (const PrincipledDiffuseBsdf *)sc;
|
||||
|
||||
float3 N = bsdf->N;
|
||||
|
||||
@@ -99,7 +99,7 @@ ccl_device int bsdf_disney_diffuse_sample(const ShaderClosure *sc,
|
||||
if(dot(Ng, *omega_in) > 0) {
|
||||
float3 H = normalize(I + *omega_in);
|
||||
|
||||
*eval = calculate_disney_diffuse_brdf(bsdf, N, I, *omega_in, H, pdf);
|
||||
*eval = calculate_principled_diffuse_brdf(bsdf, N, I, *omega_in, H, pdf);
|
||||
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
// TODO: find a better approximation for the diffuse bounce
|
||||
@@ -115,6 +115,6 @@ ccl_device int bsdf_disney_diffuse_sample(const ShaderClosure *sc,
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __BSDF_DISNEY_DIFFUSE_H__ */
|
||||
#endif /* __BSDF_PRINCIPLED_DIFFUSE_H__ */
|
||||
|
||||
|
||||
@@ -14,22 +14,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __BSDF_DISNEY_SHEEN_H__
|
||||
#define __BSDF_DISNEY_SHEEN_H__
|
||||
#ifndef __BSDF_PRINCIPLED_SHEEN_H__
|
||||
#define __BSDF_PRINCIPLED_SHEEN_H__
|
||||
|
||||
/* DISNEY SHEEN BRDF
|
||||
/* DISNEY PRINCIPLED SHEEN BRDF
|
||||
*
|
||||
* Shading model by Brent Burley (Disney): "Physically Based Shading at Disney" (2012)
|
||||
*/
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
typedef ccl_addr_space struct DisneySheenBsdf {
|
||||
typedef ccl_addr_space struct PrincipledSheenBsdf {
|
||||
SHADER_CLOSURE_BASE;
|
||||
float3 N;
|
||||
} DisneySheenBsdf;
|
||||
} PrincipledSheenBsdf;
|
||||
|
||||
ccl_device float3 calculate_disney_sheen_brdf(const DisneySheenBsdf *bsdf,
|
||||
ccl_device float3 calculate_principled_sheen_brdf(const PrincipledSheenBsdf *bsdf,
|
||||
float3 N, float3 V, float3 L, float3 H, float *pdf)
|
||||
{
|
||||
float NdotL = dot(N, L);
|
||||
@@ -47,16 +47,16 @@ ccl_device float3 calculate_disney_sheen_brdf(const DisneySheenBsdf *bsdf,
|
||||
return make_float3(value, value, value);
|
||||
}
|
||||
|
||||
ccl_device int bsdf_disney_sheen_setup(DisneySheenBsdf *bsdf)
|
||||
ccl_device int bsdf_principled_sheen_setup(PrincipledSheenBsdf *bsdf)
|
||||
{
|
||||
bsdf->type = CLOSURE_BSDF_DISNEY_SHEEN_ID;
|
||||
bsdf->type = CLOSURE_BSDF_PRINCIPLED_SHEEN_ID;
|
||||
return SD_BSDF|SD_BSDF_HAS_EVAL;
|
||||
}
|
||||
|
||||
ccl_device float3 bsdf_disney_sheen_eval_reflect(const ShaderClosure *sc, const float3 I,
|
||||
ccl_device float3 bsdf_principled_sheen_eval_reflect(const ShaderClosure *sc, const float3 I,
|
||||
const float3 omega_in, float *pdf)
|
||||
{
|
||||
const DisneySheenBsdf *bsdf = (const DisneySheenBsdf *)sc;
|
||||
const PrincipledSheenBsdf *bsdf = (const PrincipledSheenBsdf *)sc;
|
||||
|
||||
float3 N = bsdf->N;
|
||||
float3 V = I; // outgoing
|
||||
@@ -65,7 +65,7 @@ ccl_device float3 bsdf_disney_sheen_eval_reflect(const ShaderClosure *sc, const
|
||||
|
||||
if(dot(N, omega_in) > 0.0f) {
|
||||
*pdf = fmaxf(dot(N, omega_in), 0.0f) * M_1_PI_F;
|
||||
return calculate_disney_sheen_brdf(bsdf, N, V, L, H, pdf);
|
||||
return calculate_principled_sheen_brdf(bsdf, N, V, L, H, pdf);
|
||||
}
|
||||
else {
|
||||
*pdf = 0.0f;
|
||||
@@ -73,18 +73,18 @@ ccl_device float3 bsdf_disney_sheen_eval_reflect(const ShaderClosure *sc, const
|
||||
}
|
||||
}
|
||||
|
||||
ccl_device float3 bsdf_disney_sheen_eval_transmit(const ShaderClosure *sc, const float3 I,
|
||||
ccl_device float3 bsdf_principled_sheen_eval_transmit(const ShaderClosure *sc, const float3 I,
|
||||
const float3 omega_in, float *pdf)
|
||||
{
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
ccl_device int bsdf_disney_sheen_sample(const ShaderClosure *sc,
|
||||
ccl_device int bsdf_principled_sheen_sample(const ShaderClosure *sc,
|
||||
float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv,
|
||||
float3 *eval, float3 *omega_in, float3 *domega_in_dx,
|
||||
float3 *domega_in_dy, float *pdf)
|
||||
{
|
||||
const DisneySheenBsdf *bsdf = (const DisneySheenBsdf *)sc;
|
||||
const PrincipledSheenBsdf *bsdf = (const PrincipledSheenBsdf *)sc;
|
||||
|
||||
float3 N = bsdf->N;
|
||||
|
||||
@@ -93,7 +93,7 @@ ccl_device int bsdf_disney_sheen_sample(const ShaderClosure *sc,
|
||||
if(dot(Ng, *omega_in) > 0) {
|
||||
float3 H = normalize(I + *omega_in);
|
||||
|
||||
*eval = calculate_disney_sheen_brdf(bsdf, N, I, *omega_in, H, pdf);
|
||||
*eval = calculate_principled_sheen_brdf(bsdf, N, I, *omega_in, H, pdf);
|
||||
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
// TODO: find a better approximation for the diffuse bounce
|
||||
@@ -109,6 +109,6 @@ ccl_device int bsdf_disney_sheen_sample(const ShaderClosure *sc,
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __BSDF_DISNEY_SHEEN_H__ */
|
||||
#endif /* __BSDF_PRINCIPLED_SHEEN_H__ */
|
||||
|
||||
|
||||
@@ -363,20 +363,20 @@ ccl_device int bssrdf_setup(Bssrdf *bssrdf, ClosureType type)
|
||||
if(bssrdf->radius < BSSRDF_MIN_RADIUS) {
|
||||
/* revert to diffuse BSDF if radius too small */
|
||||
int flag;
|
||||
if(type == CLOSURE_BSSRDF_DISNEY_ID) {
|
||||
if(type == CLOSURE_BSSRDF_PRINCIPLED_ID) {
|
||||
float roughness = bssrdf->roughness;
|
||||
float3 N = bssrdf->N;
|
||||
float3 weight = bssrdf->weight * bssrdf->base_color;
|
||||
float sample_weight = bssrdf->sample_weight;
|
||||
|
||||
DisneyDiffuseBsdf *bsdf = (DisneyDiffuseBsdf*)bssrdf;
|
||||
PrincipledDiffuseBsdf *bsdf = (PrincipledDiffuseBsdf*)bssrdf;
|
||||
|
||||
bsdf->N = N;
|
||||
bsdf->roughness = roughness;
|
||||
bsdf->weight = weight;
|
||||
bsdf->sample_weight = sample_weight;
|
||||
flag = bsdf_disney_diffuse_setup(bsdf);
|
||||
bsdf->type = CLOSURE_BSDF_BSSRDF_DISNEY_ID;
|
||||
flag = bsdf_principled_diffuse_setup(bsdf);
|
||||
bsdf->type = CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID;
|
||||
}
|
||||
else {
|
||||
DiffuseBsdf *bsdf = (DiffuseBsdf*)bssrdf;
|
||||
@@ -392,7 +392,7 @@ ccl_device int bssrdf_setup(Bssrdf *bssrdf, ClosureType type)
|
||||
bssrdf->sharpness = saturate(bssrdf->sharpness);
|
||||
bssrdf->type = type;
|
||||
|
||||
if(type == CLOSURE_BSSRDF_BURLEY_ID || type == CLOSURE_BSSRDF_DISNEY_ID) {
|
||||
if(type == CLOSURE_BSSRDF_BURLEY_ID || type == CLOSURE_BSSRDF_PRINCIPLED_ID) {
|
||||
bssrdf_burley_setup(bssrdf);
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ ccl_device void bssrdf_sample(const ShaderClosure *sc, float xi, float *r, float
|
||||
bssrdf_cubic_sample(sc, xi, r, h);
|
||||
else if(sc->type == CLOSURE_BSSRDF_GAUSSIAN_ID)
|
||||
bssrdf_gaussian_sample(sc, xi, r, h);
|
||||
else /*if(sc->type == CLOSURE_BSSRDF_BURLEY_ID || sc->type == CLOSURE_BSSRDF_DISNEY_ID)*/
|
||||
else /*if(sc->type == CLOSURE_BSSRDF_BURLEY_ID || sc->type == CLOSURE_BSSRDF_PRINCIPLED_ID)*/
|
||||
bssrdf_burley_sample(sc, xi, r, h);
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ ccl_device_forceinline float bssrdf_pdf(const ShaderClosure *sc, float r)
|
||||
return bssrdf_cubic_pdf(sc, r);
|
||||
else if(sc->type == CLOSURE_BSSRDF_GAUSSIAN_ID)
|
||||
return bssrdf_gaussian_pdf(sc, r);
|
||||
else /*if(sc->type == CLOSURE_BSSRDF_BURLEY_ID || sc->type == CLOSURE_BSSRDF_DISNEY_ID)*/
|
||||
else /*if(sc->type == CLOSURE_BSSRDF_BURLEY_ID || sc->type == CLOSURE_BSSRDF_PRINCIPLED_ID)*/
|
||||
return bssrdf_burley_pdf(sc, r);
|
||||
}
|
||||
|
||||
|
||||
@@ -149,17 +149,17 @@ ccl_device void subsurface_scatter_setup_diffuse_bsdf(ShaderData *sd, ShaderClos
|
||||
|
||||
if(hit) {
|
||||
Bssrdf *bssrdf = (Bssrdf *)sc;
|
||||
if(bssrdf->type == CLOSURE_BSSRDF_DISNEY_ID) {
|
||||
DisneyDiffuseBsdf *bsdf = (DisneyDiffuseBsdf*)bsdf_alloc(sd, sizeof(DisneyDiffuseBsdf), weight * bssrdf->base_color);
|
||||
if(bssrdf->type == CLOSURE_BSSRDF_PRINCIPLED_ID) {
|
||||
PrincipledDiffuseBsdf *bsdf = (PrincipledDiffuseBsdf*)bsdf_alloc(sd, sizeof(PrincipledDiffuseBsdf), weight * bssrdf->base_color);
|
||||
|
||||
if(bsdf) {
|
||||
bsdf->N = N;
|
||||
bsdf->roughness = bssrdf->roughness;
|
||||
sd->flag |= bsdf_disney_diffuse_setup(bsdf);
|
||||
sd->flag |= bsdf_principled_diffuse_setup(bsdf);
|
||||
|
||||
/* replace CLOSURE_BSDF_DISNEY_DIFFUSE_ID with this special ID so render passes
|
||||
* can recognize it as not being a regular Disney diffuse closure */
|
||||
bsdf->type = CLOSURE_BSDF_BSSRDF_DISNEY_ID;
|
||||
/* replace CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID with this special ID so render passes
|
||||
* can recognize it as not being a regular Disney principled diffuse closure */
|
||||
bsdf->type = CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include "closure/alloc.h"
|
||||
#include "closure/bsdf_util.h"
|
||||
#include "closure/bsdf_diffuse.h"
|
||||
#include "closure/bsdf_disney_diffuse.h"
|
||||
#include "closure/bsdf_principled_diffuse.h"
|
||||
#include "closure/bssrdf.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
@@ -188,32 +188,32 @@ ClosureParam *closure_bssrdf_burley_params()
|
||||
|
||||
CCLOSURE_PREPARE(closure_bssrdf_burley_prepare, BurleyBSSRDFClosure)
|
||||
|
||||
/* Disney */
|
||||
/* Disney principled */
|
||||
|
||||
class DisneyBSSRDFClosure : public CBSSRDFClosure {
|
||||
class PrincipledBSSRDFClosure : public CBSSRDFClosure {
|
||||
public:
|
||||
void setup(ShaderData *sd, int path_flag, float3 weight)
|
||||
{
|
||||
alloc(sd, path_flag, weight, CLOSURE_BSSRDF_DISNEY_ID);
|
||||
alloc(sd, path_flag, weight, CLOSURE_BSSRDF_PRINCIPLED_ID);
|
||||
}
|
||||
};
|
||||
|
||||
ClosureParam *closure_bssrdf_disney_params()
|
||||
ClosureParam *closure_bssrdf_principled_params()
|
||||
{
|
||||
static ClosureParam params[] = {
|
||||
CLOSURE_FLOAT3_PARAM(DisneyBSSRDFClosure, params.N),
|
||||
CLOSURE_FLOAT3_PARAM(DisneyBSSRDFClosure, radius),
|
||||
CLOSURE_FLOAT_PARAM(DisneyBSSRDFClosure, params.texture_blur),
|
||||
CLOSURE_FLOAT3_PARAM(DisneyBSSRDFClosure, params.base_color),
|
||||
CLOSURE_FLOAT3_PARAM(DisneyBSSRDFClosure, albedo),
|
||||
CLOSURE_FLOAT_PARAM(DisneyBSSRDFClosure, params.roughness),
|
||||
CLOSURE_STRING_KEYPARAM(DisneyBSSRDFClosure, label, "label"),
|
||||
CLOSURE_FINISH_PARAM(DisneyBSSRDFClosure)
|
||||
CLOSURE_FLOAT3_PARAM(PrincipledBSSRDFClosure, params.N),
|
||||
CLOSURE_FLOAT3_PARAM(PrincipledBSSRDFClosure, radius),
|
||||
CLOSURE_FLOAT_PARAM(PrincipledBSSRDFClosure, params.texture_blur),
|
||||
CLOSURE_FLOAT3_PARAM(PrincipledBSSRDFClosure, params.base_color),
|
||||
CLOSURE_FLOAT3_PARAM(PrincipledBSSRDFClosure, albedo),
|
||||
CLOSURE_FLOAT_PARAM(PrincipledBSSRDFClosure, params.roughness),
|
||||
CLOSURE_STRING_KEYPARAM(PrincipledBSSRDFClosure, label, "label"),
|
||||
CLOSURE_FINISH_PARAM(PrincipledBSSRDFClosure)
|
||||
};
|
||||
return params;
|
||||
}
|
||||
|
||||
CCLOSURE_PREPARE(closure_bssrdf_disney_prepare, DisneyBSSRDFClosure)
|
||||
CCLOSURE_PREPARE(closure_bssrdf_principled_prepare, PrincipledBSSRDFClosure)
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
||||
@@ -59,8 +59,8 @@
|
||||
#include "closure/bsdf_ashikhmin_shirley.h"
|
||||
#include "closure/bsdf_toon.h"
|
||||
#include "closure/bsdf_hair.h"
|
||||
#include "closure/bsdf_disney_diffuse.h"
|
||||
#include "closure/bsdf_disney_sheen.h"
|
||||
#include "closure/bsdf_principled_diffuse.h"
|
||||
#include "closure/bsdf_principled_sheen.h"
|
||||
#include "closure/volume.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
@@ -177,17 +177,17 @@ VOLUME_CLOSURE_CLASS_END(VolumeHenyeyGreenstein, henyey_greenstein)
|
||||
VOLUME_CLOSURE_CLASS_BEGIN(VolumeAbsorption, absorption, ShaderClosure, LABEL_SINGULAR)
|
||||
VOLUME_CLOSURE_CLASS_END(VolumeAbsorption, absorption)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(DisneyDiffuse, disney_diffuse, DisneyDiffuseBsdf, LABEL_DIFFUSE)
|
||||
CLOSURE_FLOAT3_PARAM(DisneyDiffuseClosure, params.N),
|
||||
CLOSURE_FLOAT_PARAM(DisneyDiffuseClosure, params.roughness),
|
||||
BSDF_CLOSURE_CLASS_END(DisneyDiffuse, disney_diffuse)
|
||||
BSDF_CLOSURE_CLASS_BEGIN(PrincipledDiffuse, principled_diffuse, PrincipledDiffuseBsdf, LABEL_DIFFUSE)
|
||||
CLOSURE_FLOAT3_PARAM(PrincipledDiffuseClosure, params.N),
|
||||
CLOSURE_FLOAT_PARAM(PrincipledDiffuseClosure, params.roughness),
|
||||
BSDF_CLOSURE_CLASS_END(PrincipledDiffuse, principled_diffuse)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(DisneySheen, disney_sheen, DisneySheenBsdf, LABEL_DIFFUSE)
|
||||
CLOSURE_FLOAT3_PARAM(DisneySheenClosure, params.N),
|
||||
BSDF_CLOSURE_CLASS_END(DisneySheen, disney_sheen)
|
||||
BSDF_CLOSURE_CLASS_BEGIN(PrincipledSheen, principled_sheen, PrincipledSheenBsdf, LABEL_DIFFUSE)
|
||||
CLOSURE_FLOAT3_PARAM(PrincipledSheenClosure, params.N),
|
||||
BSDF_CLOSURE_CLASS_END(PrincipledSheen, principled_sheen)
|
||||
|
||||
/* DISNEY CLEARCOAT */
|
||||
class DisneyClearcoatClosure : public CBSDFClosure {
|
||||
/* DISNEY PRINCIPLED CLEARCOAT */
|
||||
class PrincipledClearcoatClosure : public CBSDFClosure {
|
||||
public:
|
||||
MicrofacetBsdf params;
|
||||
float clearcoat, clearcoat_gloss;
|
||||
@@ -220,18 +220,18 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
ClosureParam *closure_bsdf_disney_clearcoat_params()
|
||||
ClosureParam *closure_bsdf_principled_clearcoat_params()
|
||||
{
|
||||
static ClosureParam params[] = {
|
||||
CLOSURE_FLOAT3_PARAM(DisneyClearcoatClosure, params.N),
|
||||
CLOSURE_FLOAT_PARAM(DisneyClearcoatClosure, clearcoat),
|
||||
CLOSURE_FLOAT_PARAM(DisneyClearcoatClosure, clearcoat_gloss),
|
||||
CLOSURE_STRING_KEYPARAM(DisneyClearcoatClosure, label, "label"),
|
||||
CLOSURE_FINISH_PARAM(DisneyClearcoatClosure)
|
||||
CLOSURE_FLOAT3_PARAM(PrincipledClearcoatClosure, params.N),
|
||||
CLOSURE_FLOAT_PARAM(PrincipledClearcoatClosure, clearcoat),
|
||||
CLOSURE_FLOAT_PARAM(PrincipledClearcoatClosure, clearcoat_gloss),
|
||||
CLOSURE_STRING_KEYPARAM(PrincipledClearcoatClosure, label, "label"),
|
||||
CLOSURE_FINISH_PARAM(PrincipledClearcoatClosure)
|
||||
};
|
||||
return params;
|
||||
}
|
||||
CCLOSURE_PREPARE(closure_bsdf_disney_clearcoat_prepare, DisneyClearcoatClosure)
|
||||
CCLOSURE_PREPARE(closure_bsdf_principled_clearcoat_prepare, PrincipledClearcoatClosure)
|
||||
|
||||
|
||||
/* Registration */
|
||||
@@ -297,12 +297,12 @@ void OSLShader::register_closures(OSLShadingSystem *ss_)
|
||||
bsdf_diffuse_toon_params(), bsdf_diffuse_toon_prepare);
|
||||
register_closure(ss, "glossy_toon", id++,
|
||||
bsdf_glossy_toon_params(), bsdf_glossy_toon_prepare);
|
||||
register_closure(ss, "disney_diffuse", id++,
|
||||
bsdf_disney_diffuse_params(), bsdf_disney_diffuse_prepare);
|
||||
register_closure(ss, "disney_sheen", id++,
|
||||
bsdf_disney_sheen_params(), bsdf_disney_sheen_prepare);
|
||||
register_closure(ss, "disney_clearcoat", id++,
|
||||
closure_bsdf_disney_clearcoat_params(), closure_bsdf_disney_clearcoat_prepare);
|
||||
register_closure(ss, "principled_diffuse", id++,
|
||||
bsdf_principled_diffuse_params(), bsdf_principled_diffuse_prepare);
|
||||
register_closure(ss, "principled_sheen", id++,
|
||||
bsdf_principled_sheen_params(), bsdf_principled_sheen_prepare);
|
||||
register_closure(ss, "principled_clearcoat", id++,
|
||||
closure_bsdf_principled_clearcoat_params(), closure_bsdf_principled_clearcoat_prepare);
|
||||
|
||||
register_closure(ss, "emission", id++,
|
||||
closure_emission_params(), closure_emission_prepare);
|
||||
@@ -322,8 +322,8 @@ void OSLShader::register_closures(OSLShadingSystem *ss_)
|
||||
closure_bssrdf_gaussian_params(), closure_bssrdf_gaussian_prepare);
|
||||
register_closure(ss, "bssrdf_burley", id++,
|
||||
closure_bssrdf_burley_params(), closure_bssrdf_burley_prepare);
|
||||
register_closure(ss, "bssrdf_disney", id++,
|
||||
closure_bssrdf_disney_params(), closure_bssrdf_disney_prepare);
|
||||
register_closure(ss, "bssrdf_principled", id++,
|
||||
closure_bssrdf_principled_params(), closure_bssrdf_principled_prepare);
|
||||
|
||||
register_closure(ss, "hair_reflection", id++,
|
||||
bsdf_hair_reflection_params(), bsdf_hair_reflection_prepare);
|
||||
|
||||
@@ -51,7 +51,7 @@ OSL::ClosureParam *closure_bsdf_phong_ramp_params();
|
||||
OSL::ClosureParam *closure_bssrdf_cubic_params();
|
||||
OSL::ClosureParam *closure_bssrdf_gaussian_params();
|
||||
OSL::ClosureParam *closure_bssrdf_burley_params();
|
||||
OSL::ClosureParam *closure_bssrdf_disney_params();
|
||||
OSL::ClosureParam *closure_bssrdf_principled_params();
|
||||
OSL::ClosureParam *closure_henyey_greenstein_volume_params();
|
||||
OSL::ClosureParam *closure_bsdf_microfacet_multi_ggx_params();
|
||||
OSL::ClosureParam *closure_bsdf_microfacet_multi_ggx_glass_params();
|
||||
@@ -71,7 +71,7 @@ void closure_bsdf_phong_ramp_prepare(OSL::RendererServices *, int id, void *data
|
||||
void closure_bssrdf_cubic_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_bssrdf_gaussian_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_bssrdf_burley_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_bssrdf_disney_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_bssrdf_principled_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_henyey_greenstein_volume_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_bsdf_microfacet_multi_ggx_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_bsdf_microfacet_multi_ggx_glass_prepare(OSL::RendererServices *, int id, void *data);
|
||||
|
||||
@@ -81,7 +81,7 @@ set(SRC_OSL
|
||||
node_wireframe.osl
|
||||
node_hair_bsdf.osl
|
||||
node_uv_map.osl
|
||||
node_disney_bsdf.osl
|
||||
node_principled_bsdf.osl
|
||||
node_rgb_to_bw.osl
|
||||
)
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "stdosl.h"
|
||||
#include "node_fresnel.h"
|
||||
|
||||
shader node_disney_bsdf(
|
||||
shader node_principled_bsdf(
|
||||
string distribution = "Multiscatter GGX",
|
||||
color BaseColor = color(0.8, 0.8, 0.8),
|
||||
float Subsurface = 0.0,
|
||||
@@ -57,15 +57,15 @@ shader node_disney_bsdf(
|
||||
|
||||
if (diffuse_weight > 1e-5) {
|
||||
if (Subsurface > 1e-5) {
|
||||
BSDF = bssrdf_disney(Normal, Subsurface * SubsurfaceRadius, 0.0, BaseColor, SubsurfaceColor, Roughness);
|
||||
BSDF = bssrdf_principled(Normal, Subsurface * SubsurfaceRadius, 0.0, BaseColor, SubsurfaceColor, Roughness);
|
||||
} else {
|
||||
BSDF = BaseColor * disney_diffuse(Normal, Roughness);
|
||||
BSDF = BaseColor * principled_diffuse(Normal, Roughness);
|
||||
}
|
||||
|
||||
if (Sheen > 1e-5) {
|
||||
color sheen_color = color(1.0, 1.0, 1.0) * (1.0 - SheenTint) + m_ctint * SheenTint;
|
||||
|
||||
BSDF = BSDF + sheen_color * Sheen * disney_sheen(Normal);
|
||||
BSDF = BSDF + sheen_color * Sheen * principled_sheen(Normal);
|
||||
}
|
||||
|
||||
BSDF = BSDF * diffuse_weight;
|
||||
@@ -113,7 +113,7 @@ shader node_disney_bsdf(
|
||||
}
|
||||
|
||||
if (Clearcoat > 1e-5) {
|
||||
BSDF = BSDF + disney_clearcoat(ClearcoatNormal, Clearcoat, ClearcoatGloss);
|
||||
BSDF = BSDF + principled_clearcoat(ClearcoatNormal, Clearcoat, ClearcoatGloss);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,15 +544,15 @@ closure color emission() BUILTIN;
|
||||
closure color background() BUILTIN;
|
||||
closure color holdout() BUILTIN;
|
||||
closure color ambient_occlusion() BUILTIN;
|
||||
closure color disney_diffuse(normal N, float roughness) BUILTIN;
|
||||
closure color disney_sheen(normal N) BUILTIN;
|
||||
closure color disney_clearcoat(normal N, float clearcoat, float clearcoat_gloss) BUILTIN;
|
||||
closure color principled_diffuse(normal N, float roughness) BUILTIN;
|
||||
closure color principled_sheen(normal N) BUILTIN;
|
||||
closure color principled_clearcoat(normal N, float clearcoat, float clearcoat_gloss) BUILTIN;
|
||||
|
||||
// BSSRDF
|
||||
closure color bssrdf_cubic(normal N, vector radius, float texture_blur, float sharpness) BUILTIN;
|
||||
closure color bssrdf_gaussian(normal N, vector radius, float texture_blur) BUILTIN;
|
||||
closure color bssrdf_burley(normal N, vector radius, float texture_blur, color albedo) BUILTIN;
|
||||
closure color bssrdf_disney(normal N, vector radius, float texture_blur, color base_color, color subsurface_color, float roughness) BUILTIN;
|
||||
closure color bssrdf_principled(normal N, vector radius, float texture_blur, color base_color, color subsurface_color, float roughness) BUILTIN;
|
||||
|
||||
// Hair
|
||||
closure color hair_reflection(normal N, float roughnessu, float roughnessv, vector T, float offset) BUILTIN;
|
||||
|
||||
@@ -76,7 +76,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
|
||||
float param2 = (stack_valid(param2_offset))? stack_load_float(stack, param2_offset): __uint_as_float(node.w);
|
||||
|
||||
switch(type) {
|
||||
case CLOSURE_BSDF_DISNEY_ID: {
|
||||
case CLOSURE_BSDF_PRINCIPLED_ID: {
|
||||
uint specular_offset, roughness_offset, specular_tint_offset, anisotropic_offset, sheen_offset,
|
||||
sheen_tint_offset, clearcoat_offset, clearcoat_gloss_offset, eta_offset, transparency_offset,
|
||||
anisotropic_rotation_offset, refraction_roughness_offset;
|
||||
@@ -87,7 +87,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
|
||||
decode_node_uchar4(data_node.w, &sheen_offset, &sheen_tint_offset, &clearcoat_offset, &clearcoat_gloss_offset);
|
||||
decode_node_uchar4(data_node2.x, &eta_offset, &transparency_offset, &anisotropic_rotation_offset, &refraction_roughness_offset);
|
||||
|
||||
// get disney parameters
|
||||
// get Disney principled parameters
|
||||
float metallic = param1;
|
||||
float subsurface = param2;
|
||||
float specular = stack_load_float(stack, specular_offset);
|
||||
@@ -155,14 +155,14 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
|
||||
if(subsurface < CLOSURE_WEIGHT_CUTOFF && diffuse_weight > CLOSURE_WEIGHT_CUTOFF && fabsf(average(base_color)) > CLOSURE_WEIGHT_CUTOFF) {
|
||||
float3 diff_weight = weight * base_color * diffuse_weight;
|
||||
|
||||
DisneyDiffuseBsdf *bsdf = (DisneyDiffuseBsdf*)bsdf_alloc(sd, sizeof(DisneyDiffuseBsdf), diff_weight);
|
||||
PrincipledDiffuseBsdf *bsdf = (PrincipledDiffuseBsdf*)bsdf_alloc(sd, sizeof(PrincipledDiffuseBsdf), diff_weight);
|
||||
|
||||
if(bsdf) {
|
||||
bsdf->N = N;
|
||||
bsdf->roughness = roughness;
|
||||
|
||||
/* setup bsdf */
|
||||
ccl_fetch(sd, flag) |= bsdf_disney_diffuse_setup(bsdf);
|
||||
ccl_fetch(sd, flag) |= bsdf_principled_diffuse_setup(bsdf);
|
||||
}
|
||||
}
|
||||
else if(subsurf_sample_weight > CLOSURE_WEIGHT_CUTOFF) {
|
||||
@@ -186,7 +186,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
|
||||
bssrdf->roughness = roughness;
|
||||
|
||||
/* setup bsdf */
|
||||
ccl_fetch(sd, flag) |= bssrdf_setup(bssrdf, (ClosureType)CLOSURE_BSSRDF_DISNEY_ID);
|
||||
ccl_fetch(sd, flag) |= bssrdf_setup(bssrdf, (ClosureType)CLOSURE_BSSRDF_PRINCIPLED_ID);
|
||||
}
|
||||
|
||||
bssrdf = bssrdf_alloc(sd, make_float3(0.0f, subsurf_weight.y, 0.0f));
|
||||
@@ -201,7 +201,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
|
||||
bssrdf->roughness = roughness;
|
||||
|
||||
/* setup bsdf */
|
||||
ccl_fetch(sd, flag) |= bssrdf_setup(bssrdf, (ClosureType)CLOSURE_BSSRDF_DISNEY_ID);
|
||||
ccl_fetch(sd, flag) |= bssrdf_setup(bssrdf, (ClosureType)CLOSURE_BSSRDF_PRINCIPLED_ID);
|
||||
}
|
||||
|
||||
bssrdf = bssrdf_alloc(sd, make_float3(0.0f, 0.0f, subsurf_weight.z));
|
||||
@@ -216,7 +216,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
|
||||
bssrdf->roughness = roughness;
|
||||
|
||||
/* setup bsdf */
|
||||
ccl_fetch(sd, flag) |= bssrdf_setup(bssrdf, (ClosureType)CLOSURE_BSSRDF_DISNEY_ID);
|
||||
ccl_fetch(sd, flag) |= bssrdf_setup(bssrdf, (ClosureType)CLOSURE_BSSRDF_PRINCIPLED_ID);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -224,14 +224,14 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
|
||||
if(diffuse_weight > CLOSURE_WEIGHT_CUTOFF) {
|
||||
float3 diff_weight = weight * base_color * diffuse_weight;
|
||||
|
||||
DisneyDiffuseBsdf *bsdf = (DisneyDiffuseBsdf*)bsdf_alloc(sd, sizeof(DisneyDiffuseBsdf), diff_weight);
|
||||
PrincipledDiffuseBsdf *bsdf = (PrincipledDiffuseBsdf*)bsdf_alloc(sd, sizeof(PrincipledDiffuseBsdf), diff_weight);
|
||||
|
||||
if(bsdf) {
|
||||
bsdf->N = N;
|
||||
bsdf->roughness = roughness;
|
||||
|
||||
/* setup bsdf */
|
||||
ccl_fetch(sd, flag) |= bsdf_disney_diffuse_setup(bsdf);
|
||||
ccl_fetch(sd, flag) |= bsdf_principled_diffuse_setup(bsdf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -246,13 +246,13 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
|
||||
|
||||
float3 sheen_weight = weight * sheen * sheen_color * diffuse_weight;
|
||||
|
||||
DisneySheenBsdf *bsdf = (DisneySheenBsdf*)bsdf_alloc(sd, sizeof(DisneySheenBsdf), sheen_weight);
|
||||
PrincipledSheenBsdf *bsdf = (PrincipledSheenBsdf*)bsdf_alloc(sd, sizeof(PrincipledSheenBsdf), sheen_weight);
|
||||
|
||||
if(bsdf) {
|
||||
bsdf->N = N;
|
||||
|
||||
/* setup bsdf */
|
||||
ccl_fetch(sd, flag) |= bsdf_disney_sheen_setup(bsdf);
|
||||
ccl_fetch(sd, flag) |= bsdf_principled_sheen_setup(bsdf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -395,8 +395,8 @@ typedef enum ClosureType {
|
||||
CLOSURE_BSDF_DIFFUSE_ID,
|
||||
CLOSURE_BSDF_OREN_NAYAR_ID,
|
||||
CLOSURE_BSDF_DIFFUSE_RAMP_ID,
|
||||
CLOSURE_BSDF_DISNEY_DIFFUSE_ID,
|
||||
CLOSURE_BSDF_DISNEY_SHEEN_ID,
|
||||
CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID,
|
||||
CLOSURE_BSDF_PRINCIPLED_SHEEN_ID,
|
||||
CLOSURE_BSDF_DIFFUSE_TOON_ID,
|
||||
|
||||
/* Glossy */
|
||||
@@ -435,13 +435,13 @@ typedef enum ClosureType {
|
||||
|
||||
/* Special cases */
|
||||
CLOSURE_BSDF_BSSRDF_ID,
|
||||
CLOSURE_BSDF_BSSRDF_DISNEY_ID,
|
||||
CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID,
|
||||
CLOSURE_BSDF_TRANSPARENT_ID,
|
||||
|
||||
/* BSSRDF */
|
||||
CLOSURE_BSSRDF_CUBIC_ID,
|
||||
CLOSURE_BSSRDF_GAUSSIAN_ID,
|
||||
CLOSURE_BSSRDF_DISNEY_ID,
|
||||
CLOSURE_BSSRDF_PRINCIPLED_ID,
|
||||
CLOSURE_BSSRDF_BURLEY_ID,
|
||||
|
||||
/* Other */
|
||||
@@ -455,7 +455,7 @@ typedef enum ClosureType {
|
||||
CLOSURE_VOLUME_ABSORPTION_ID,
|
||||
CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID,
|
||||
|
||||
CLOSURE_BSDF_DISNEY_ID,
|
||||
CLOSURE_BSDF_PRINCIPLED_ID,
|
||||
|
||||
NBUILTIN_CLOSURES
|
||||
} ClosureType;
|
||||
@@ -465,7 +465,7 @@ typedef enum ClosureType {
|
||||
#define CLOSURE_IS_BSDF_DIFFUSE(type) (type >= CLOSURE_BSDF_DIFFUSE_ID && type <= CLOSURE_BSDF_DIFFUSE_TOON_ID)
|
||||
#define CLOSURE_IS_BSDF_GLOSSY(type) (type >= CLOSURE_BSDF_GLOSSY_ID && type <= CLOSURE_BSDF_HAIR_REFLECTION_ID)
|
||||
#define CLOSURE_IS_BSDF_TRANSMISSION(type) (type >= CLOSURE_BSDF_TRANSMISSION_ID && type <= CLOSURE_BSDF_HAIR_TRANSMISSION_ID)
|
||||
#define CLOSURE_IS_BSDF_BSSRDF(type) (type == CLOSURE_BSDF_BSSRDF_ID || type == CLOSURE_BSDF_BSSRDF_DISNEY_ID)
|
||||
#define CLOSURE_IS_BSDF_BSSRDF(type) (type == CLOSURE_BSDF_BSSRDF_ID || type == CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID)
|
||||
#define CLOSURE_IS_BSDF_ANISOTROPIC(type) (type >= CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID && type <= CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID)
|
||||
#define CLOSURE_IS_BSDF_MULTISCATTER(type) (type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID ||\
|
||||
type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ANISO_ID || \
|
||||
@@ -479,7 +479,7 @@ typedef enum ClosureType {
|
||||
#define CLOSURE_IS_AMBIENT_OCCLUSION(type) (type == CLOSURE_AMBIENT_OCCLUSION_ID)
|
||||
#define CLOSURE_IS_PHASE(type) (type == CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID)
|
||||
#define CLOSURE_IS_GLASS(type) (type >= CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID && type <= CLOSURE_BSDF_SHARP_GLASS_ID)
|
||||
#define CLOSURE_IS_DISNEY(type) (type == CLOSURE_BSDF_DISNEY_ID)
|
||||
#define CLOSURE_IS_PRINCIPLED(type) (type == CLOSURE_BSDF_PRINCIPLED_ID)
|
||||
|
||||
#define CLOSURE_WEIGHT_CUTOFF 1e-5f
|
||||
|
||||
|
||||
@@ -979,7 +979,7 @@ int ShaderGraph::get_num_closures()
|
||||
else if(CLOSURE_IS_BSDF_MULTISCATTER(closure_type)) {
|
||||
num_closures += 2;
|
||||
}
|
||||
else if(CLOSURE_IS_DISNEY(closure_type)) {
|
||||
else if(CLOSURE_IS_PRINCIPLED(closure_type)) {
|
||||
num_closures += 8;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -2220,10 +2220,10 @@ void DiffuseBsdfNode::compile(OSLCompiler& compiler)
|
||||
compiler.add(this, "node_diffuse_bsdf");
|
||||
}
|
||||
|
||||
/* Disney BSDF Closure */
|
||||
NODE_DEFINE(DisneyBsdfNode)
|
||||
/* Disney principled BSDF Closure */
|
||||
NODE_DEFINE(PrincipledBsdfNode)
|
||||
{
|
||||
NodeType* type = NodeType::add("disney_bsdf", create, NodeType::SHADER);
|
||||
NodeType* type = NodeType::add("principled_bsdf", create, NodeType::SHADER);
|
||||
|
||||
static NodeEnum distribution_enum;
|
||||
distribution_enum.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID);
|
||||
@@ -2256,16 +2256,16 @@ NODE_DEFINE(DisneyBsdfNode)
|
||||
return type;
|
||||
}
|
||||
|
||||
DisneyBsdfNode::DisneyBsdfNode()
|
||||
PrincipledBsdfNode::PrincipledBsdfNode()
|
||||
: ShaderNode(node_type)
|
||||
{
|
||||
special_type = SHADER_SPECIAL_TYPE_CLOSURE;
|
||||
closure = CLOSURE_BSDF_DISNEY_ID;
|
||||
closure = CLOSURE_BSDF_PRINCIPLED_ID;
|
||||
distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID;
|
||||
distribution_orig = NBUILTIN_CLOSURES;
|
||||
}
|
||||
|
||||
void DisneyBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes)
|
||||
void PrincipledBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes)
|
||||
{
|
||||
if(shader->has_surface) {
|
||||
ShaderInput *tangent_in = input("Tangent");
|
||||
@@ -2277,7 +2277,7 @@ void DisneyBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes)
|
||||
ShaderNode::attributes(shader, attributes);
|
||||
}
|
||||
|
||||
void DisneyBsdfNode::compile(SVMCompiler& compiler, ShaderInput *p_metallic, ShaderInput *p_subsurface, ShaderInput *p_subsurface_radius,
|
||||
void PrincipledBsdfNode::compile(SVMCompiler& compiler, ShaderInput *p_metallic, ShaderInput *p_subsurface, ShaderInput *p_subsurface_radius,
|
||||
ShaderInput *p_specular, ShaderInput *p_roughness, ShaderInput *p_specular_tint, ShaderInput *p_anisotropic,
|
||||
ShaderInput *p_sheen, ShaderInput *p_sheen_tint, ShaderInput *p_clearcoat, ShaderInput *p_clearcoat_gloss,
|
||||
ShaderInput *p_ior, ShaderInput *p_transparency, ShaderInput *p_anisotropic_rotation, ShaderInput *p_refraction_roughness)
|
||||
@@ -2337,13 +2337,13 @@ void DisneyBsdfNode::compile(SVMCompiler& compiler, ShaderInput *p_metallic, Sha
|
||||
__float_as_int(ss_default.x), __float_as_int(ss_default.y), __float_as_int(ss_default.z));
|
||||
}
|
||||
|
||||
bool DisneyBsdfNode::has_integrator_dependency()
|
||||
bool PrincipledBsdfNode::has_integrator_dependency()
|
||||
{
|
||||
ShaderInput *roughness_input = input("Roughness");
|
||||
return !roughness_input->link && roughness <= 1e-4f;
|
||||
}
|
||||
|
||||
void DisneyBsdfNode::compile(SVMCompiler& compiler)
|
||||
void PrincipledBsdfNode::compile(SVMCompiler& compiler)
|
||||
{
|
||||
compile(compiler, input("Metallic"), input("Subsurface"), input("Subsurface Radius"), input("Specular"),
|
||||
input("Roughness"), input("Specular Tint"), input("Anisotropic"), input("Sheen"), input("Sheen Tint"),
|
||||
@@ -2351,13 +2351,13 @@ void DisneyBsdfNode::compile(SVMCompiler& compiler)
|
||||
input("Anisotropic Rotation"), input("Refraction Roughness"));
|
||||
}
|
||||
|
||||
void DisneyBsdfNode::compile(OSLCompiler& compiler)
|
||||
void PrincipledBsdfNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
compiler.parameter(this, "distribution");
|
||||
compiler.add(this, "node_disney_bsdf");
|
||||
compiler.add(this, "node_principled_bsdf");
|
||||
}
|
||||
|
||||
bool DisneyBsdfNode::has_bssrdf_bump()
|
||||
bool PrincipledBsdfNode::has_bssrdf_bump()
|
||||
{
|
||||
/* detect if anything is plugged into the normal input besides the default */
|
||||
ShaderInput *normal_in = input("Normal");
|
||||
|
||||
@@ -361,10 +361,10 @@ public:
|
||||
float roughness;
|
||||
};
|
||||
|
||||
/* Disney BRDF */
|
||||
class DisneyBsdfNode : public ShaderNode {
|
||||
/* Disney principled BRDF */
|
||||
class PrincipledBsdfNode : public ShaderNode {
|
||||
public:
|
||||
SHADER_NODE_CLASS(DisneyBsdfNode)
|
||||
SHADER_NODE_CLASS(PrincipledBsdfNode)
|
||||
|
||||
bool has_spatial_varying() { return true; }
|
||||
bool has_surface_bssrdf() { return true; }
|
||||
|
||||
@@ -219,7 +219,7 @@ shader_node_categories = [
|
||||
NodeItem("ShaderNodeMixShader"),
|
||||
NodeItem("ShaderNodeAddShader"),
|
||||
NodeItem("ShaderNodeBsdfDiffuse", poll=object_shader_nodes_poll),
|
||||
NodeItem("ShaderNodeBsdfDisney", poll=object_shader_nodes_poll),
|
||||
NodeItem("ShaderNodeBsdfPrincipled", poll=object_shader_nodes_poll),
|
||||
NodeItem("ShaderNodeBsdfGlossy", poll=object_shader_nodes_poll),
|
||||
NodeItem("ShaderNodeBsdfTransparent", poll=object_shader_nodes_poll),
|
||||
NodeItem("ShaderNodeBsdfRefraction", poll=object_shader_nodes_poll),
|
||||
|
||||
@@ -787,7 +787,7 @@ struct ShadeResult;
|
||||
#define SH_NODE_OUTPUT_LINESTYLE 190
|
||||
#define SH_NODE_UVALONGSTROKE 191
|
||||
#define SH_NODE_TEX_POINTDENSITY 192
|
||||
#define SH_NODE_BSDF_DISNEY 193
|
||||
#define SH_NODE_BSDF_PRINCIPLED 193
|
||||
|
||||
/* custom defines options for Material node */
|
||||
#define SH_NODE_MAT_DIFF 1
|
||||
|
||||
@@ -3591,7 +3591,7 @@ static void registerShaderNodes(void)
|
||||
register_node_type_sh_background();
|
||||
register_node_type_sh_bsdf_anisotropic();
|
||||
register_node_type_sh_bsdf_diffuse();
|
||||
register_node_type_sh_bsdf_disney();
|
||||
register_node_type_sh_bsdf_principled();
|
||||
register_node_type_sh_bsdf_glossy();
|
||||
register_node_type_sh_bsdf_glass();
|
||||
register_node_type_sh_bsdf_translucent();
|
||||
|
||||
@@ -1234,7 +1234,7 @@ static void node_shader_set_butfunc(bNodeType *ntype)
|
||||
case SH_NODE_BSDF_GLOSSY:
|
||||
case SH_NODE_BSDF_GLASS:
|
||||
case SH_NODE_BSDF_REFRACTION:
|
||||
case SH_NODE_BSDF_DISNEY:
|
||||
case SH_NODE_BSDF_PRINCIPLED:
|
||||
ntype->draw_buttons = node_shader_buts_glossy;
|
||||
break;
|
||||
case SH_NODE_BSDF_ANISOTROPIC:
|
||||
|
||||
@@ -2553,7 +2553,7 @@ void node_bsdf_toon(vec4 color, float size, float tsmooth, vec3 N, out vec4 resu
|
||||
node_bsdf_diffuse(color, 0.0, N, result);
|
||||
}
|
||||
|
||||
void node_bsdf_disney(vec4 base_color, float subsurface, vec3 subsurface_radius, vec4 subsurface_color, float metallic, float specular,
|
||||
void node_bsdf_principled(vec4 base_color, float subsurface, vec3 subsurface_radius, vec4 subsurface_color, float metallic, float specular,
|
||||
float specular_tint, float roughness, float anisotropic, float anisotropic_rotation, float sheen, float sheen_tint, float clearcoat,
|
||||
float clearcoat_gloss, float ior, float transparency, float refraction_roughness, vec3 N, vec3 CN, vec3 T, out vec4 result)
|
||||
{
|
||||
|
||||
@@ -2995,7 +2995,7 @@ static void rna_ShaderNodeScript_update(Main *bmain, Scene *scene, PointerRNA *p
|
||||
ED_node_tag_update_nodetree(bmain, ntree, node);
|
||||
}
|
||||
|
||||
static void rna_ShaderNodeDisney_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
static void rna_ShaderNodePrincipled_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
{
|
||||
bNodeTree *ntree = (bNodeTree *)ptr->id.data;
|
||||
bNode *node = (bNode *)ptr->data;
|
||||
@@ -4190,9 +4190,9 @@ static void def_glass(StructRNA *srna)
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_disney(StructRNA *srna)
|
||||
static void def_principled(StructRNA *srna)
|
||||
{
|
||||
static EnumPropertyItem prop_disney_distribution_items[] = {
|
||||
static EnumPropertyItem prop_principled_distribution_items[] = {
|
||||
{ SHD_GLOSSY_GGX, "GGX", 0, "GGX", "" },
|
||||
{ SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", "" },
|
||||
{ 0, NULL, 0, NULL, NULL }
|
||||
@@ -4202,9 +4202,9 @@ static void def_disney(StructRNA *srna)
|
||||
|
||||
prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "custom1");
|
||||
RNA_def_property_enum_items(prop, prop_disney_distribution_items);
|
||||
RNA_def_property_enum_items(prop, prop_principled_distribution_items);
|
||||
RNA_def_property_ui_text(prop, "Distribution", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeDisney_update");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodePrincipled_update");
|
||||
}
|
||||
|
||||
static void def_refraction(StructRNA *srna)
|
||||
|
||||
@@ -163,7 +163,7 @@ set(SRC
|
||||
shader/nodes/node_shader_background.c
|
||||
shader/nodes/node_shader_bsdf_anisotropic.c
|
||||
shader/nodes/node_shader_bsdf_diffuse.c
|
||||
shader/nodes/node_shader_bsdf_disney.c
|
||||
shader/nodes/node_shader_bsdf_principled.c
|
||||
shader/nodes/node_shader_bsdf_glass.c
|
||||
shader/nodes/node_shader_bsdf_glossy.c
|
||||
shader/nodes/node_shader_bsdf_toon.c
|
||||
|
||||
@@ -106,7 +106,7 @@ void register_node_type_sh_bsdf_transparent(void);
|
||||
void register_node_type_sh_bsdf_velvet(void);
|
||||
void register_node_type_sh_bsdf_toon(void);
|
||||
void register_node_type_sh_bsdf_anisotropic(void);
|
||||
void register_node_type_sh_bsdf_disney(void);
|
||||
void register_node_type_sh_bsdf_principled(void);
|
||||
void register_node_type_sh_emission(void);
|
||||
void register_node_type_sh_holdout(void);
|
||||
void register_node_type_sh_volume_absorption(void);
|
||||
|
||||
@@ -80,7 +80,7 @@ DefNode( ShaderNode, SH_NODE_BACKGROUND, 0, "BA
|
||||
DefNode( ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "" )
|
||||
DefNode( ShaderNode, SH_NODE_BSDF_ANISOTROPIC, def_anisotropic, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic BSDF", "" )
|
||||
DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse BSDF", "" )
|
||||
DefNode( ShaderNode, SH_NODE_BSDF_DISNEY, def_disney, "BSDF_DISNEY", BsdfDisney, "Disney BSDF", "" )
|
||||
DefNode( ShaderNode, SH_NODE_BSDF_PRINCIPLED, def_principled, "BSDF_PRINCIPLED", BsdfPrincipled, "Principled BSDF", "" )
|
||||
DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy BSDF", "" )
|
||||
DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glass, "BSDF_GLASS", BsdfGlass, "Glass BSDF", "" )
|
||||
DefNode( ShaderNode, SH_NODE_BSDF_REFRACTION, def_refraction, "BSDF_REFRACTION", BsdfRefraction, "Refraction BSDF", "" )
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
static bNodeSocketTemplate sh_node_bsdf_disney_in[] = {
|
||||
static bNodeSocketTemplate sh_node_bsdf_principled_in[] = {
|
||||
{ SOCK_RGBA, 1, N_("Base Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
|
||||
{ SOCK_FLOAT, 1, N_("Subsurface"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||
{ SOCK_VECTOR, 1, N_("Subsurface Radius"), 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f},
|
||||
@@ -53,27 +53,27 @@ static bNodeSocketTemplate sh_node_bsdf_disney_in[] = {
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
static bNodeSocketTemplate sh_node_bsdf_disney_out[] = {
|
||||
static bNodeSocketTemplate sh_node_bsdf_principled_out[] = {
|
||||
{ SOCK_SHADER, 0, N_("BSDF")},
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
static void node_shader_init_disney(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->custom1 = SHD_GLOSSY_MULTI_GGX;
|
||||
}
|
||||
|
||||
static int node_shader_gpu_bsdf_disney(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
if (!in[16].link)
|
||||
in[16].link = GPU_builtin(GPU_VIEW_NORMAL);
|
||||
else
|
||||
GPU_link(mat, "direction_transform_m4v3", in[16].link, GPU_builtin(GPU_VIEW_MATRIX), &in[16].link);
|
||||
|
||||
return GPU_stack_link(mat, "node_bsdf_disney", in, out);
|
||||
return GPU_stack_link(mat, "node_bsdf_principled", in, out);
|
||||
}
|
||||
|
||||
static void node_shader_update_disney(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
static void node_shader_update_principled(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
bNodeSocket *sock;
|
||||
int distribution = node->custom1;
|
||||
@@ -90,18 +90,18 @@ static void node_shader_update_disney(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
}
|
||||
|
||||
/* node type definition */
|
||||
void register_node_type_sh_bsdf_disney(void)
|
||||
void register_node_type_sh_bsdf_principled(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_BSDF_DISNEY, "Disney BSDF", NODE_CLASS_SHADER, 0);
|
||||
sh_node_type_base(&ntype, SH_NODE_BSDF_PRINCIPLED, "Principled BSDF", NODE_CLASS_SHADER, 0);
|
||||
node_type_compatibility(&ntype, NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_bsdf_disney_in, sh_node_bsdf_disney_out);
|
||||
node_type_socket_templates(&ntype, sh_node_bsdf_principled_in, sh_node_bsdf_principled_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, node_shader_init_disney);
|
||||
node_type_init(&ntype, node_shader_init_principled);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_disney);
|
||||
node_type_update(&ntype, node_shader_update_disney, NULL);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_principled);
|
||||
node_type_update(&ntype, node_shader_update_principled, NULL);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
||||
Reference in New Issue
Block a user