Fix #112003: Principled Huang Hair renders black on horizontal particle hair
Curve normal is not available in legacy particle hair system. Construct a local coordinate system instead of using a fixed normal direction [1, 0, 0] to avoid black appearance.
This commit is contained in:
parent
c1e11df732
commit
077022e45f
@ -335,8 +335,8 @@ static void ExportCurveSegments(Scene *scene, Hair *hair, ParticleCurveData *CDa
|
||||
|
||||
if (attr_normal) {
|
||||
/* NOTE: the geometry normals are not computed for legacy particle hairs. This hair
|
||||
* system is expected to be discarded. */
|
||||
attr_normal->add(make_float3(1.0f, 0.0f, 0.0f));
|
||||
* system is expected to be deprecated. */
|
||||
attr_normal->add(make_float3(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
num_curve_keys++;
|
||||
|
@ -211,11 +211,18 @@ ccl_device int bsdf_hair_huang_setup(ccl_private ShaderData *sd,
|
||||
/* Align local frame with the ray direction so that `phi_i == 0`. */
|
||||
bsdf->N = X;
|
||||
}
|
||||
kernel_assert(!is_zero(bsdf->N) && isfinite_safe(bsdf->N));
|
||||
|
||||
/* Fill extra closure. */
|
||||
bsdf->extra->Z = safe_normalize(cross(bsdf->N, sd->dPdu));
|
||||
bsdf->extra->Y = safe_normalize(cross(bsdf->extra->Z, bsdf->N));
|
||||
if (is_zero(bsdf->N) || !isfinite_safe(bsdf->N)) {
|
||||
bsdf->extra->Y = Y;
|
||||
/* Construct arbitrary local coordinate system. The implementation should ensure smooth
|
||||
* transition along the hair shaft. */
|
||||
make_orthonormals(Y, &bsdf->extra->Z, &bsdf->N);
|
||||
}
|
||||
else {
|
||||
bsdf->extra->Z = safe_normalize(cross(bsdf->N, sd->dPdu));
|
||||
bsdf->extra->Y = safe_normalize(cross(bsdf->extra->Z, bsdf->N));
|
||||
}
|
||||
|
||||
const float3 I = make_float3(
|
||||
dot(sd->wi, bsdf->N), dot(sd->wi, bsdf->extra->Y), dot(sd->wi, bsdf->extra->Z));
|
||||
|
@ -48,10 +48,10 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
.max(1.0f)
|
||||
.subtype(PROP_FACTOR)
|
||||
.description(
|
||||
"For elliptical hair cross-section, the aspect ratio is the ratio of the minor axis to "
|
||||
"the major axis (the major axis is aligned with the curve normal). Recommended values "
|
||||
"are 0.8~1 for Asian hair, 0.65~0.9 for Caucasian hair, 0.5~0.65 for African hair. Set "
|
||||
"this to 1 for circular cross-section");
|
||||
"The ratio of the minor axis to the major axis of an elliptical cross-section. "
|
||||
"Recommended values are 0.8~1 for Asian hair, 0.65~0.9 for Caucasian hair, 0.5~0.65 for "
|
||||
"African hair. The major axis is aligned with the curve normal, which is not supported "
|
||||
"in particle hair");
|
||||
b.add_input<decl::Float>("Roughness")
|
||||
.default_value(0.3f)
|
||||
.min(0.0f)
|
||||
|
Loading…
Reference in New Issue
Block a user