Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/closure/bsdf_hair_principled.h
| Show First 20 Lines • Show All 202 Lines • ▼ Show 20 Lines | ccl_device int bsdf_principled_hair_setup(ShaderData *sd, PrincipledHairBSDF *bsdf) | ||||
| bsdf->v = sqr(0.726f*bsdf->v + 0.812f*sqr(bsdf->v) + 3.700f*pow20(bsdf->v)); | bsdf->v = sqr(0.726f*bsdf->v + 0.812f*sqr(bsdf->v) + 3.700f*pow20(bsdf->v)); | ||||
| bsdf->s = (0.265f*bsdf->s + 1.194f*sqr(bsdf->s) + 5.372f*pow22(bsdf->s))*M_SQRT_PI_8_F; | bsdf->s = (0.265f*bsdf->s + 1.194f*sqr(bsdf->s) + 5.372f*pow22(bsdf->s))*M_SQRT_PI_8_F; | ||||
| bsdf->m0_roughness = sqr(0.726f*bsdf->m0_roughness + 0.812f*sqr(bsdf->m0_roughness) + 3.700f*pow20(bsdf->m0_roughness)); | bsdf->m0_roughness = sqr(0.726f*bsdf->m0_roughness + 0.812f*sqr(bsdf->m0_roughness) + 3.700f*pow20(bsdf->m0_roughness)); | ||||
| /* Compute local frame, aligned to curve tangent and ray direction. */ | /* Compute local frame, aligned to curve tangent and ray direction. */ | ||||
| float3 X = safe_normalize(sd->dPdu); | float3 X = safe_normalize(sd->dPdu); | ||||
| float3 Y = safe_normalize(cross(X, sd->I)); | float3 Y = safe_normalize(cross(X, sd->I)); | ||||
| float3 Z = safe_normalize(cross(X, Y)); | float3 Z = safe_normalize(cross(X, Y)); | ||||
| /* TODO: the solution below works where sd->Ng is the normal | |||||
| * pointing from the center of the curve to the shading point. | |||||
| * It doesn't work for triangles, see https://developer.blender.org/T43625 */ | |||||
| /* h -1..0..1 means the rays goes from grazing the hair, to hitting it at | /* h -1..0..1 means the rays goes from grazing the hair, to hitting it at | ||||
| * the center, to grazing the other edge. This is the sine of the angle | * the center, to grazing the other edge. This is the sine of the angle | ||||
| * between sd->Ng and Z, as seen from the tangent X. */ | * between sd->Ng and Z, as seen from the tangent X. */ | ||||
| /* TODO: we convert this value to a cosine later and discard the sign, so | /* TODO: we convert this value to a cosine later and discard the sign, so | ||||
| * we could probably save some operations. */ | * we could probably save some operations. */ | ||||
| float h = dot(cross(sd->Ng, X), Z); | float h = dot(cross(sd->Ng, X), Z); | ||||
| ▲ Show 20 Lines • Show All 281 Lines • Show Last 20 Lines | |||||