Switched from a parameter struct for Disney parameters to ShaderClosure params
This commit is contained in:
@@ -35,8 +35,7 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* structures */
|
||||
struct DisneyClearcoatBRDFParams {
|
||||
/*struct DisneyClearcoatBRDFParams {
|
||||
// brdf parameters
|
||||
float m_clearcoat;
|
||||
float m_clearcoatGloss;
|
||||
@@ -49,21 +48,24 @@ struct DisneyClearcoatBRDFParams {
|
||||
}
|
||||
};
|
||||
|
||||
typedef struct DisneyClearcoatBRDFParams DisneyClearcoatBRDFParams;
|
||||
typedef struct DisneyClearcoatBRDFParams DisneyClearcoatBRDFParams;*/
|
||||
|
||||
|
||||
ccl_device int bsdf_disney_clearcoat_setup(ShaderClosure *sc)
|
||||
{
|
||||
/* clearcoat roughness */
|
||||
sc->custom1 = mix(0.1f, 0.001f, sc->data1);
|
||||
|
||||
sc->type = CLOSURE_BSDF_DISNEY_CLEARCOAT_ID;
|
||||
return SD_BSDF|SD_BSDF_HAS_EVAL;
|
||||
}
|
||||
|
||||
ccl_device float3 bsdf_disney_clearcoat_eval_reflect(const ShaderClosure *sc,
|
||||
const DisneyClearcoatBRDFParams *params, const float3 I,
|
||||
/*const DisneyClearcoatBRDFParams *params, */const float3 I,
|
||||
const float3 omega_in, float *pdf)
|
||||
{
|
||||
if (params->m_clearcoat > 0.0f) {
|
||||
float alpha = params->m_clearcoatRoughness;
|
||||
if (sc->data0 > 0.0f) {
|
||||
float alpha = sc->custom1;
|
||||
float3 N = sc->N;
|
||||
|
||||
if (alpha <= 1e-4f)
|
||||
@@ -100,7 +102,7 @@ ccl_device float3 bsdf_disney_clearcoat_eval_reflect(const ShaderClosure *sc,
|
||||
float FH = schlick_fresnel(dot(omega_in, m));
|
||||
float3 F = mix(make_float3(0.04f, 0.04f, 0.04f), make_float3(1.0f, 1.0f, 1.0f), FH);
|
||||
|
||||
float3 out = F * G * common * 0.25f * params->m_clearcoat;
|
||||
float3 out = F * G * common * 0.25f * sc->data0;
|
||||
|
||||
/* eq. 2 in distribution of visible normals sampling
|
||||
* pm = Dw = G1o * dot(m, I) * D / dot(N, I); */
|
||||
@@ -122,13 +124,13 @@ ccl_device float3 bsdf_disney_clearcoat_eval_transmit(const ShaderClosure *sc, c
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
ccl_device int bsdf_disney_clearcoat_sample(const ShaderClosure *sc, const DisneyClearcoatBRDFParams *params,
|
||||
ccl_device int bsdf_disney_clearcoat_sample(const ShaderClosure *sc, /*const DisneyClearcoatBRDFParams *params,*/
|
||||
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)
|
||||
{
|
||||
if (params->m_clearcoat > 0.0f) {
|
||||
float alpha = params->m_clearcoatRoughness;
|
||||
if (sc->data0 > 0.0f) {
|
||||
float alpha = sc->custom1;
|
||||
float3 N = sc->N;
|
||||
|
||||
float cosNO = dot(N, I);
|
||||
@@ -189,7 +191,7 @@ ccl_device int bsdf_disney_clearcoat_sample(const ShaderClosure *sc, const Disne
|
||||
float FH = schlick_fresnel(dot(*omega_in, m));
|
||||
float3 F = mix(make_float3(0.04f, 0.04f, 0.04f), make_float3(1.0f, 1.0f, 1.0f), FH);
|
||||
|
||||
*eval = G1i * common * F * 0.25f * params->m_clearcoat;
|
||||
*eval = G1i * common * F * 0.25f * sc->data0;
|
||||
}
|
||||
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
|
@@ -36,7 +36,7 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
struct DisneyDiffuseBRDFParams {
|
||||
/*struct DisneyDiffuseBRDFParams {
|
||||
// brdf parameters
|
||||
float3 m_base_color;
|
||||
float m_subsurface;
|
||||
@@ -45,23 +45,21 @@ struct DisneyDiffuseBRDFParams {
|
||||
float m_sheen_tint;
|
||||
|
||||
// precomputed values
|
||||
float3 m_cdlin, m_ctint, m_csheen;
|
||||
float m_cdlum;
|
||||
float3 m_csheen;
|
||||
|
||||
void precompute_values() {
|
||||
m_cdlin = m_base_color;
|
||||
m_cdlum = 0.3f * m_cdlin[0] + 0.6f * m_cdlin[1] + 0.1f * m_cdlin[2]; // luminance approx.
|
||||
float m_cdlum = 0.3f * m_base_color[0] + 0.6f * m_base_color[1] + 0.1f * m_base_color[2]; // luminance approx.
|
||||
|
||||
m_ctint = m_cdlum > 0.0f ? m_cdlin / m_cdlum : make_float3(1.0f, 1.0f, 1.0f); // normalize lum. to isolate hue+sat
|
||||
float3 m_ctint = m_cdlum > 0.0f ? m_base_color / m_cdlum : make_float3(1.0f, 1.0f, 1.0f); // normalize lum. to isolate hue+sat
|
||||
m_csheen = mix(make_float3(1.0f, 1.0f, 1.0f), m_ctint, m_sheen_tint);
|
||||
}
|
||||
};
|
||||
|
||||
typedef struct DisneyDiffuseBRDFParams DisneyDiffuseBRDFParams;
|
||||
typedef struct DisneyDiffuseBRDFParams DisneyDiffuseBRDFParams;*/
|
||||
|
||||
|
||||
ccl_device float3 calculate_disney_diffuse_brdf(const ShaderClosure *sc,
|
||||
const DisneyDiffuseBRDFParams *params, float3 N, float3 V, float3 L,
|
||||
/*const DisneyDiffuseBRDFParams *params, */float3 N, float3 V, float3 L,
|
||||
float3 H, float *pdf)
|
||||
{
|
||||
float NdotL = dot(N, L);
|
||||
@@ -77,27 +75,27 @@ ccl_device float3 calculate_disney_diffuse_brdf(const ShaderClosure *sc,
|
||||
float Fd = 0.0f;
|
||||
float FL = schlick_fresnel(NdotL), FV = schlick_fresnel(NdotV);
|
||||
|
||||
if (params->m_subsurface != 1.0f) {
|
||||
const float Fd90 = 0.5f + 2.0f * LdotH*LdotH * params->m_roughness;
|
||||
if (sc->data0 != 1.0f) {
|
||||
const float Fd90 = 0.5f + 2.0f * LdotH*LdotH * sc->data1;
|
||||
Fd = mix(1.0f, Fd90, FL) * mix(1.0f, Fd90, FV);
|
||||
}
|
||||
|
||||
if (params->m_subsurface > 0.0f) {
|
||||
float Fss90 = LdotH*LdotH * params->m_roughness;
|
||||
if (sc->data0 > 0.0f) {
|
||||
float Fss90 = LdotH*LdotH * sc->data1;
|
||||
float Fss = mix(1.0f, Fss90, FL) * mix(1.0f, Fss90, FV);
|
||||
float ss = 1.25f * (Fss * (1.0f / (NdotL + NdotV) - 0.5f) + 0.5f);
|
||||
Fd = mix(Fd, ss, params->m_subsurface);
|
||||
Fd = mix(Fd, ss, sc->data0);
|
||||
}
|
||||
|
||||
float3 value = M_1_PI_F * Fd * params->m_cdlin;
|
||||
float3 value = M_1_PI_F * Fd * sc->color0;
|
||||
|
||||
*pdf = M_1_PI_F * 0.5f;
|
||||
|
||||
// sheen component
|
||||
if (params->m_sheen != 0.0f) {
|
||||
if (sc->data2 != 0.0f) {
|
||||
float FH = schlick_fresnel(LdotH);
|
||||
|
||||
value += FH * params->m_sheen * params->m_csheen;
|
||||
value += FH * sc->data2 * sc->custom_color0;
|
||||
}
|
||||
|
||||
value *= NdotL;
|
||||
@@ -107,12 +105,19 @@ ccl_device float3 calculate_disney_diffuse_brdf(const ShaderClosure *sc,
|
||||
|
||||
ccl_device int bsdf_disney_diffuse_setup(ShaderClosure *sc)
|
||||
{
|
||||
float m_cdlum = 0.3f * sc->color0[0] + 0.6f * sc->color0[1] + 0.1f * sc->color0[2]; // luminance approx.
|
||||
|
||||
float3 m_ctint = m_cdlum > 0.0f ? sc->color0 / m_cdlum : make_float3(1.0f, 1.0f, 1.0f); // normalize lum. to isolate hue+sat
|
||||
|
||||
/* csheen0 */
|
||||
sc->custom_color0 = mix(make_float3(1.0f, 1.0f, 1.0f), m_ctint, sc->data3);
|
||||
|
||||
sc->type = CLOSURE_BSDF_DISNEY_DIFFUSE_ID;
|
||||
return SD_BSDF|SD_BSDF_HAS_EVAL;
|
||||
}
|
||||
|
||||
ccl_device float3 bsdf_disney_diffuse_eval_reflect(const ShaderClosure *sc,
|
||||
const DisneyDiffuseBRDFParams *params, const float3 I,
|
||||
/*const DisneyDiffuseBRDFParams *params, */const float3 I,
|
||||
const float3 omega_in, float *pdf)
|
||||
{
|
||||
float3 N = normalize(sc->N);
|
||||
@@ -121,7 +126,7 @@ ccl_device float3 bsdf_disney_diffuse_eval_reflect(const ShaderClosure *sc,
|
||||
float3 H = normalize(L + V);
|
||||
|
||||
if (dot(sc->N, omega_in) > 0.0f) {
|
||||
float3 value = calculate_disney_diffuse_brdf(sc, params, N, V, L, H, pdf);
|
||||
float3 value = calculate_disney_diffuse_brdf(sc, /*params, */N, V, L, H, pdf);
|
||||
|
||||
return value;
|
||||
}
|
||||
@@ -136,7 +141,7 @@ ccl_device float3 bsdf_disney_diffuse_eval_transmit(const ShaderClosure *sc, con
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
ccl_device int bsdf_disney_diffuse_sample(const ShaderClosure *sc, const DisneyDiffuseBRDFParams *params,
|
||||
ccl_device int bsdf_disney_diffuse_sample(const ShaderClosure *sc, /*const DisneyDiffuseBRDFParams *params,*/
|
||||
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)
|
||||
@@ -148,7 +153,7 @@ ccl_device int bsdf_disney_diffuse_sample(const ShaderClosure *sc, const DisneyD
|
||||
if (dot(Ng, *omega_in) > 0) {
|
||||
float3 H = normalize(I + *omega_in);
|
||||
|
||||
*eval = calculate_disney_diffuse_brdf(sc, params, N, I, *omega_in, H, pdf);
|
||||
*eval = calculate_disney_diffuse_brdf(sc, /*params, */N, I, *omega_in, H, pdf);
|
||||
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
// TODO: find a better approximation for the diffuse bounce
|
||||
|
@@ -35,7 +35,7 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
struct DisneySpecularBRDFParams {
|
||||
/*struct DisneySpecularBRDFParams {
|
||||
// brdf parameters
|
||||
float3 m_base_color;
|
||||
float m_metallic;
|
||||
@@ -45,16 +45,15 @@ struct DisneySpecularBRDFParams {
|
||||
float m_anisotropic;
|
||||
|
||||
// precomputed values
|
||||
float3 m_cdlin, m_ctint, m_cspec0;
|
||||
float m_cdlum;
|
||||
float3 m_cspec0;
|
||||
float m_ax, m_ay;
|
||||
float m_roughg;
|
||||
|
||||
void precompute_values() {
|
||||
m_cdlin = m_base_color;
|
||||
m_cdlum = 0.3f * m_cdlin[0] + 0.6f * m_cdlin[1] + 0.1f * m_cdlin[2]; // luminance approx.
|
||||
float3 m_cdlin = m_base_color;
|
||||
float m_cdlum = 0.3f * m_cdlin[0] + 0.6f * m_cdlin[1] + 0.1f * m_cdlin[2]; // luminance approx.
|
||||
|
||||
m_ctint = m_cdlum > 0.0f ? m_cdlin / m_cdlum : make_float3(1.0f, 1.0f, 1.0f); // normalize lum. to isolate hue+sat
|
||||
float3 m_ctint = m_cdlum > 0.0f ? m_cdlin / m_cdlum : make_float3(1.0f, 1.0f, 1.0f); // normalize lum. to isolate hue+sat
|
||||
|
||||
m_cspec0 = mix(m_specular * 0.08f * mix(make_float3(1.0f, 1.0f, 1.0f),
|
||||
m_ctint, m_specular_tint), m_cdlin, m_metallic);
|
||||
@@ -68,21 +67,40 @@ struct DisneySpecularBRDFParams {
|
||||
}
|
||||
};
|
||||
|
||||
typedef struct DisneySpecularBRDFParams DisneySpecularBRDFParams;
|
||||
typedef struct DisneySpecularBRDFParams DisneySpecularBRDFParams;*/
|
||||
|
||||
|
||||
ccl_device int bsdf_disney_specular_setup(ShaderClosure *sc)
|
||||
{
|
||||
float m_cdlum = 0.3f * sc->color0[0] + 0.6f * sc->color0[1] + 0.1f * sc->color0[2]; // luminance approx.
|
||||
|
||||
float3 m_ctint = m_cdlum > 0.0f ? sc->color0 / m_cdlum : make_float3(1.0f, 1.0f, 1.0f); // normalize lum. to isolate hue+sat
|
||||
|
||||
sc->custom_color0 = mix(sc->data1 * 0.08f * mix(make_float3(1.0f, 1.0f, 1.0f),
|
||||
m_ctint, sc->data2), sc->color0, sc->data0);
|
||||
|
||||
float aspect = sqrt(1.0f - sc->data4 * 0.9f);
|
||||
float r2 = sqr(sc->data3);
|
||||
|
||||
/* ax */
|
||||
sc->custom1 = fmaxf(0.001f, r2 / aspect);
|
||||
|
||||
/* ay */
|
||||
sc->custom2 = fmaxf(0.001f, r2 * aspect);
|
||||
|
||||
/* rough_g */
|
||||
sc->custom3 = sqr(sc->data3 * 0.5f + 0.5f);
|
||||
|
||||
sc->type = CLOSURE_BSDF_DISNEY_SPECULAR_ID;
|
||||
return SD_BSDF|SD_BSDF_HAS_EVAL;
|
||||
}
|
||||
|
||||
ccl_device float3 bsdf_disney_specular_eval_reflect(const ShaderClosure *sc,
|
||||
const DisneySpecularBRDFParams *params, const float3 I,
|
||||
/*const DisneySpecularBRDFParams *params, */const float3 I,
|
||||
const float3 omega_in, float *pdf)
|
||||
{
|
||||
float alpha_x = params->m_ax;
|
||||
float alpha_y = params->m_ay;
|
||||
float alpha_x = sc->custom1;
|
||||
float alpha_y = sc->custom2;
|
||||
float3 N = sc->N;
|
||||
|
||||
if (fmaxf(alpha_x, alpha_y) <= 1e-4f)
|
||||
@@ -154,7 +172,7 @@ ccl_device float3 bsdf_disney_specular_eval_reflect(const ShaderClosure *sc,
|
||||
float common = D * 0.25f / cosNO;
|
||||
|
||||
float FH = schlick_fresnel(dot(omega_in, m));
|
||||
float3 F = mix(params->m_cspec0, make_float3(1.0f, 1.0f, 1.0f), FH);
|
||||
float3 F = mix(sc->custom_color0, make_float3(1.0f, 1.0f, 1.0f), FH);
|
||||
|
||||
float3 out = F * G * common;
|
||||
|
||||
@@ -177,13 +195,13 @@ ccl_device float3 bsdf_disney_specular_eval_transmit(const ShaderClosure *sc, co
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
ccl_device int bsdf_disney_specular_sample(const ShaderClosure *sc, const DisneySpecularBRDFParams *params,
|
||||
ccl_device int bsdf_disney_specular_sample(const ShaderClosure *sc, /*const DisneySpecularBRDFParams *params,*/
|
||||
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)
|
||||
{
|
||||
float alpha_x = params->m_ax;
|
||||
float alpha_y = params->m_ay;
|
||||
float alpha_x = sc->custom1;
|
||||
float alpha_y = sc->custom2;
|
||||
float3 N = sc->N;
|
||||
|
||||
float cosNO = dot(N, I);
|
||||
@@ -269,7 +287,7 @@ ccl_device int bsdf_disney_specular_sample(const ShaderClosure *sc, const Disney
|
||||
*pdf = common;
|
||||
|
||||
float FH = schlick_fresnel(dot(*omega_in, m));
|
||||
float3 F = mix(params->m_cspec0, make_float3(1.0f, 1.0f, 1.0f), FH);
|
||||
float3 F = mix(sc->custom_color0, make_float3(1.0f, 1.0f, 1.0f), FH);
|
||||
|
||||
*eval = G1i * common * F;
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ using namespace OSL;
|
||||
|
||||
class DisneyClearcoatClosure : public CBSDFClosure {
|
||||
public:
|
||||
DisneyClearcoatBRDFParams dp;
|
||||
//DisneyClearcoatBRDFParams dp;
|
||||
|
||||
DisneyClearcoatClosure() : CBSDFClosure(LABEL_REFLECT|LABEL_GLOSSY)
|
||||
{}
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
sc.prim = this;
|
||||
m_shaderdata_flag = bsdf_disney_clearcoat_setup(&sc);
|
||||
|
||||
dp.precompute_values();
|
||||
//dp.precompute_values();
|
||||
}
|
||||
|
||||
void blur(float roughness)
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
|
||||
float3 eval_reflect(const float3 &omega_out, const float3 &omega_in, float& pdf) const
|
||||
{
|
||||
return bsdf_disney_clearcoat_eval_reflect(&sc, &dp, omega_out, omega_in, &pdf);
|
||||
return bsdf_disney_clearcoat_eval_reflect(&sc, /*&dp, */omega_out, omega_in, &pdf);
|
||||
}
|
||||
|
||||
float3 eval_transmit(const float3 &omega_out, const float3 &omega_in, float& pdf) const
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
float3 &omega_in, float3 &domega_in_dx, float3 &domega_in_dy,
|
||||
float &pdf, float3 &eval) const
|
||||
{
|
||||
return bsdf_disney_clearcoat_sample(&sc, &dp, Ng, omega_out, domega_out_dx, domega_out_dy,
|
||||
return bsdf_disney_clearcoat_sample(&sc, /*&dp, */Ng, omega_out, domega_out_dx, domega_out_dy,
|
||||
randu, randv, &eval, &omega_in, &domega_in_dx, &domega_in_dy, &pdf);
|
||||
}
|
||||
};
|
||||
@@ -90,8 +90,8 @@ ClosureParam *closure_bsdf_disney_clearcoat_params()
|
||||
{
|
||||
static ClosureParam params[] = {
|
||||
CLOSURE_FLOAT3_PARAM(DisneyClearcoatClosure, sc.N),
|
||||
CLOSURE_FLOAT_PARAM(DisneyClearcoatClosure, dp.m_clearcoat),
|
||||
CLOSURE_FLOAT_PARAM(DisneyClearcoatClosure, dp.m_clearcoatGloss),
|
||||
CLOSURE_FLOAT_PARAM(DisneyClearcoatClosure, sc.data0), /*clearcoat*/
|
||||
CLOSURE_FLOAT_PARAM(DisneyClearcoatClosure, sc.data1), /*clearcoat gloss*/
|
||||
CLOSURE_STRING_KEYPARAM(DisneyClearcoatClosure, label, "label"),
|
||||
CLOSURE_FINISH_PARAM(DisneyClearcoatClosure)
|
||||
};
|
||||
|
@@ -48,7 +48,7 @@ using namespace OSL;
|
||||
|
||||
class DisneyDiffuseClosure : public CBSDFClosure {
|
||||
public:
|
||||
DisneyDiffuseBRDFParams dp;
|
||||
//DisneyDiffuseBRDFParams dp;
|
||||
|
||||
DisneyDiffuseClosure() : CBSDFClosure(LABEL_DIFFUSE)
|
||||
{}
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
sc.prim = this;
|
||||
m_shaderdata_flag = bsdf_disney_diffuse_setup(&sc);
|
||||
|
||||
dp.precompute_values();
|
||||
//dp.precompute_values();
|
||||
}
|
||||
|
||||
void blur(float roughness)
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
|
||||
float3 eval_reflect(const float3 &omega_out, const float3 &omega_in, float& pdf) const
|
||||
{
|
||||
return bsdf_disney_diffuse_eval_reflect(&sc, &dp, omega_out, omega_in, &pdf);
|
||||
return bsdf_disney_diffuse_eval_reflect(&sc, /*&dp, */omega_out, omega_in, &pdf);
|
||||
}
|
||||
|
||||
float3 eval_transmit(const float3 &omega_out, const float3 &omega_in, float& pdf) const
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
const float3 &domega_out_dy, float randu, float randv, float3 &omega_in,
|
||||
float3 &domega_in_dx, float3 &domega_in_dy, float &pdf, float3 &eval) const
|
||||
{
|
||||
return bsdf_disney_diffuse_sample(&sc, &dp, Ng, omega_out, domega_out_dx, domega_out_dy,
|
||||
return bsdf_disney_diffuse_sample(&sc, /*&dp, */Ng, omega_out, domega_out_dx, domega_out_dy,
|
||||
randu, randv, &eval, &omega_in, &domega_in_dx, &domega_in_dy, &pdf);
|
||||
}
|
||||
};
|
||||
@@ -88,11 +88,11 @@ ClosureParam *closure_bsdf_disney_diffuse_params()
|
||||
{
|
||||
static ClosureParam params[] = {
|
||||
CLOSURE_FLOAT3_PARAM(DisneyDiffuseClosure, sc.N),
|
||||
CLOSURE_FLOAT3_PARAM(DisneyDiffuseClosure, dp.m_base_color),
|
||||
CLOSURE_FLOAT_PARAM(DisneyDiffuseClosure, dp.m_subsurface),
|
||||
CLOSURE_FLOAT_PARAM(DisneyDiffuseClosure, dp.m_roughness),
|
||||
CLOSURE_FLOAT_PARAM(DisneyDiffuseClosure, dp.m_sheen),
|
||||
CLOSURE_FLOAT_PARAM(DisneyDiffuseClosure, dp.m_sheen_tint),
|
||||
CLOSURE_FLOAT3_PARAM(DisneyDiffuseClosure, sc.color0), /*base color*/
|
||||
CLOSURE_FLOAT_PARAM(DisneyDiffuseClosure, sc.data0), /*subsurface*/
|
||||
CLOSURE_FLOAT_PARAM(DisneyDiffuseClosure, sc.data1), /*roughness*/
|
||||
CLOSURE_FLOAT_PARAM(DisneyDiffuseClosure, sc.data2), /*sheen*/
|
||||
CLOSURE_FLOAT_PARAM(DisneyDiffuseClosure, sc.data3), /*sheen tint*/
|
||||
CLOSURE_STRING_KEYPARAM(DisneyDiffuseClosure, label, "label"),
|
||||
CLOSURE_FINISH_PARAM(DisneyDiffuseClosure)
|
||||
};
|
||||
|
@@ -48,7 +48,7 @@ using namespace OSL;
|
||||
|
||||
class DisneySpecularClosure : public CBSDFClosure {
|
||||
public:
|
||||
DisneySpecularBRDFParams dp;
|
||||
//DisneySpecularBRDFParams dp;
|
||||
|
||||
DisneySpecularClosure() : CBSDFClosure(LABEL_REFLECT|LABEL_GLOSSY)
|
||||
{}
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
sc.prim = this;
|
||||
m_shaderdata_flag = bsdf_disney_specular_setup(&sc);
|
||||
|
||||
dp.precompute_values();
|
||||
//dp.precompute_values();
|
||||
}
|
||||
|
||||
void blur(float roughness)
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
|
||||
float3 eval_reflect(const float3 &omega_out, const float3 &omega_in, float& pdf) const
|
||||
{
|
||||
return bsdf_disney_specular_eval_reflect(&sc, &dp, omega_out, omega_in, &pdf);
|
||||
return bsdf_disney_specular_eval_reflect(&sc, /*&dp, */omega_out, omega_in, &pdf);
|
||||
}
|
||||
|
||||
float3 eval_transmit(const float3 &omega_out, const float3 &omega_in, float& pdf) const
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
const float3 &domega_out_dy, float randu, float randv, float3 &omega_in,
|
||||
float3 &domega_in_dx, float3 &domega_in_dy, float &pdf, float3 &eval) const
|
||||
{
|
||||
return bsdf_disney_specular_sample(&sc, &dp, Ng, omega_out, domega_out_dx, domega_out_dy,
|
||||
return bsdf_disney_specular_sample(&sc, /*&dp, */Ng, omega_out, domega_out_dx, domega_out_dy,
|
||||
randu, randv, &eval, &omega_in, &domega_in_dx, &domega_in_dy, &pdf);
|
||||
}
|
||||
};
|
||||
@@ -89,12 +89,12 @@ ClosureParam *closure_bsdf_disney_specular_params()
|
||||
static ClosureParam params[] = {
|
||||
CLOSURE_FLOAT3_PARAM(DisneySpecularClosure, sc.N),
|
||||
CLOSURE_FLOAT3_PARAM(DisneySpecularClosure, sc.T),
|
||||
CLOSURE_FLOAT3_PARAM(DisneySpecularClosure, dp.m_base_color),
|
||||
CLOSURE_FLOAT_PARAM(DisneySpecularClosure, dp.m_metallic),
|
||||
CLOSURE_FLOAT_PARAM(DisneySpecularClosure, dp.m_specular),
|
||||
CLOSURE_FLOAT_PARAM(DisneySpecularClosure, dp.m_specular_tint),
|
||||
CLOSURE_FLOAT_PARAM(DisneySpecularClosure, dp.m_roughness),
|
||||
CLOSURE_FLOAT_PARAM(DisneySpecularClosure, dp.m_anisotropic),
|
||||
CLOSURE_FLOAT3_PARAM(DisneySpecularClosure, sc.color0), /*base color*/
|
||||
CLOSURE_FLOAT_PARAM(DisneySpecularClosure, sc.data0), /*metallic*/
|
||||
CLOSURE_FLOAT_PARAM(DisneySpecularClosure, sc.data1), /*specular*/
|
||||
CLOSURE_FLOAT_PARAM(DisneySpecularClosure, sc.data2), /*specular tint*/
|
||||
CLOSURE_FLOAT_PARAM(DisneySpecularClosure, sc.data3), /*roughness*/
|
||||
CLOSURE_FLOAT_PARAM(DisneySpecularClosure, sc.data4), /*anisotropic*/
|
||||
CLOSURE_STRING_KEYPARAM(DisneySpecularClosure, label, "label"),
|
||||
CLOSURE_FINISH_PARAM(DisneySpecularClosure)
|
||||
};
|
||||
|
@@ -376,8 +376,8 @@ typedef enum ClosureType {
|
||||
CLOSURE_BSDF_DIFFUSE_ID,
|
||||
CLOSURE_BSDF_OREN_NAYAR_ID,
|
||||
CLOSURE_BSDF_DIFFUSE_RAMP_ID,
|
||||
CLOSURE_BSDF_DIFFUSE_TOON_ID,
|
||||
CLOSURE_BSDF_DISNEY_DIFFUSE_ID,
|
||||
CLOSURE_BSDF_DIFFUSE_TOON_ID,
|
||||
|
||||
/* Glossy */
|
||||
CLOSURE_BSDF_GLOSSY_ID,
|
||||
@@ -391,9 +391,9 @@ typedef enum ClosureType {
|
||||
CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
|
||||
CLOSURE_BSDF_PHONG_RAMP_ID,
|
||||
CLOSURE_BSDF_GLOSSY_TOON_ID,
|
||||
CLOSURE_BSDF_HAIR_REFLECTION_ID,
|
||||
CLOSURE_BSDF_DISNEY_SPECULAR_ID,
|
||||
CLOSURE_BSDF_DISNEY_CLEARCOAT_ID,
|
||||
CLOSURE_BSDF_HAIR_REFLECTION_ID,
|
||||
|
||||
/* Transmission */
|
||||
CLOSURE_BSDF_TRANSMISSION_ID,
|
||||
|
Reference in New Issue
Block a user