Start with less parameters
This commit is contained in:
parent
5be12da189
commit
b08064d867
|
@ -1169,14 +1169,11 @@ ccl_device int bsdf_microfacet_hair_sample_elliptic(const KernelGlobals kg,
|
|||
const float3 Y = safe_normalize(sd->dPdu);
|
||||
const float3 Z0 = safe_normalize(cross(X0, Y));
|
||||
|
||||
/* rotate (Z,X) around Y */
|
||||
const float curve_parameter = bsdf->extra->attr_descr_intercept;
|
||||
const float curve_length = bsdf->extra->attr_descr_length;
|
||||
const float curve_twist_rate = bsdf->extra->twist_rate;
|
||||
const float curve_twist_start = bsdf->extra->axis_rot;
|
||||
/* const float curve_parameter = bsdf->extra->attr_descr_intercept; */
|
||||
/* const float curve_length = bsdf->extra->attr_descr_length; */
|
||||
|
||||
const float twist_angle = M_2PI_F * (curve_twist_start +
|
||||
curve_twist_rate * curve_parameter * curve_length);
|
||||
/* TODO: compute the ellipse orientation based on the curve normal or user-defined normal? */
|
||||
const float twist_angle = 0.0f;
|
||||
const float sin_twist_angle = sinf(twist_angle);
|
||||
const float cos_twist_angle = cosf(twist_angle);
|
||||
|
||||
|
|
|
@ -1023,20 +1023,14 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
|
|||
if (model_type == NODE_MICROFACET_HAIR_ELLIPTIC_GGX ||
|
||||
model_type == NODE_MICROFACET_HAIR_ELLIPTIC_BECKMANN) {
|
||||
|
||||
uint eccentricity_ofs, twist_rate_ofs, axis_ofs;
|
||||
svm_unpack_node_uchar4(
|
||||
data_node7.x, &eccentricity_ofs, &twist_rate_ofs, &axis_ofs, &temp);
|
||||
uint eccentricity_ofs;
|
||||
svm_unpack_node_uchar4(data_node7.x, &eccentricity_ofs, &temp, &temp, &temp);
|
||||
|
||||
float eccentricity = stack_load_float_default(stack, eccentricity_ofs, data_node7.y);
|
||||
float twist_rate = stack_load_float_default(stack, twist_rate_ofs, data_node7.z);
|
||||
float axis_rot = stack_load_float_default(stack, axis_ofs, data_node7.w);
|
||||
|
||||
/* Eccentricity */
|
||||
bsdf->extra->eccentricity = (eccentricity > 1.f) ? 1.f / eccentricity : eccentricity;
|
||||
|
||||
/* Angular twist rate per unit length */
|
||||
bsdf->extra->twist_rate = twist_rate;
|
||||
|
||||
const AttributeDescriptor attr_descr_intercept = find_attribute(kg, sd, data_node4.z);
|
||||
bsdf->extra->attr_descr_intercept = curve_attribute_float(
|
||||
kg, sd, attr_descr_intercept, NULL, NULL);
|
||||
|
@ -1044,10 +1038,6 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
|
|||
const AttributeDescriptor attr_descr_length = find_attribute(kg, sd, data_node4.w);
|
||||
bsdf->extra->attr_descr_length = curve_attribute_float(
|
||||
kg, sd, attr_descr_length, NULL, NULL);
|
||||
|
||||
bsdf->extra->axis_rot = axis_rot > 0.0f ?
|
||||
random * axis_rot :
|
||||
-axis_rot; // allowing this negative mode for debugging
|
||||
}
|
||||
|
||||
sd->flag |= bsdf_microfacet_hair_setup(sd, bsdf);
|
||||
|
|
|
@ -3666,8 +3666,6 @@ NODE_DEFINE(MicrofacetHairBsdfNode)
|
|||
SocketType::VECTOR);
|
||||
|
||||
SOCKET_IN_FLOAT(eccentricity, "Eccentricity", 0.85f);
|
||||
SOCKET_IN_FLOAT(random_axis, "Random Axis", 0.0f);
|
||||
SOCKET_IN_FLOAT(twist_rate, "Twist Rate", 0.0f);
|
||||
|
||||
SOCKET_IN_FLOAT(offset, "Offset", 2.f * M_PI_F / 180.f);
|
||||
SOCKET_IN_FLOAT(roughness, "Roughness", 0.3f);
|
||||
|
@ -3729,8 +3727,6 @@ void MicrofacetHairBsdfNode::compile(SVMCompiler &compiler)
|
|||
ShaderInput *Blur_in = input("Blur");
|
||||
|
||||
ShaderInput *eccentricity_in = input("Eccentricity");
|
||||
ShaderInput *random_axis_in = input("Random Axis");
|
||||
ShaderInput *twist_rate_in = input("Twist Rate");
|
||||
|
||||
int color_ofs = compiler.stack_assign(input("Color"));
|
||||
int tint_ofs = compiler.stack_assign(input("Tint"));
|
||||
|
@ -3809,12 +3805,12 @@ void MicrofacetHairBsdfNode::compile(SVMCompiler &compiler)
|
|||
|
||||
/* data node 7 */
|
||||
compiler.add_node(compiler.encode_uchar4(compiler.stack_assign_if_linked(eccentricity_in),
|
||||
compiler.stack_assign_if_linked(twist_rate_in),
|
||||
compiler.stack_assign_if_linked(random_axis_in),
|
||||
SVM_STACK_INVALID,
|
||||
SVM_STACK_INVALID,
|
||||
SVM_STACK_INVALID),
|
||||
__float_as_uint(eccentricity),
|
||||
__float_as_uint(twist_rate),
|
||||
__float_as_uint(random_axis));
|
||||
0,
|
||||
0);
|
||||
}
|
||||
|
||||
/* Prepares the input data for the OSL shader. */
|
||||
|
|
|
@ -32,15 +32,6 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.min(0.0f)
|
||||
.max(1.0f)
|
||||
.subtype(PROP_FACTOR);
|
||||
b.add_input<decl::Float>(N_("Random Axis"))
|
||||
.default_value(0.0f)
|
||||
.min(-1.0f)
|
||||
.max(1.0f);
|
||||
b.add_input<decl::Float>(N_("Twist Rate"))
|
||||
.default_value(0.0f)
|
||||
.min(0.0f)
|
||||
.max(2.0f)
|
||||
.subtype(PROP_FACTOR);
|
||||
b.add_input<decl::Float>(N_("Roughness"))
|
||||
.default_value(0.3f)
|
||||
.min(0.0f)
|
||||
|
@ -106,9 +97,6 @@ static void node_shader_update_hair_microfacet(bNodeTree *ntree, bNode *node)
|
|||
int parametrization = node->custom1;
|
||||
int model_type = node->custom2;
|
||||
|
||||
bool circular = (model_type == SHD_MICROFACET_HAIR_CIRCULAR_GGX ||
|
||||
model_type == SHD_MICROFACET_HAIR_CIRCULAR_GGX_ANALYTIC ||
|
||||
model_type == SHD_MICROFACET_HAIR_CIRCULAR_BECKMANN);
|
||||
bool elliptical = (model_type == SHD_MICROFACET_HAIR_ELLIPTIC_GGX ||
|
||||
model_type == SHD_MICROFACET_HAIR_ELLIPTIC_BECKMANN);
|
||||
|
||||
|
@ -139,12 +127,6 @@ static void node_shader_update_hair_microfacet(bNodeTree *ntree, bNode *node)
|
|||
else if (STREQ(sock->name, "Eccentricity")) {
|
||||
nodeSetSocketAvailability(ntree, sock, elliptical);
|
||||
}
|
||||
else if (STREQ(sock->name, "Random Axis")) {
|
||||
nodeSetSocketAvailability(ntree, sock, elliptical);
|
||||
}
|
||||
else if (STREQ(sock->name, "Twist Rate")) {
|
||||
nodeSetSocketAvailability(ntree, sock, elliptical);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue