Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/closure/bsdf_hair.h
| Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | ccl_device int bsdf_hair_transmission_setup(ShaderClosure *sc) | ||||
| sc->data0 = clamp(sc->data0, 0.001f, 1.0f); | sc->data0 = clamp(sc->data0, 0.001f, 1.0f); | ||||
| sc->data1 = clamp(sc->data1, 0.001f, 1.0f); | sc->data1 = clamp(sc->data1, 0.001f, 1.0f); | ||||
| return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY; | return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY; | ||||
| } | } | ||||
| ccl_device float3 bsdf_hair_reflection_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf) | ccl_device float3 bsdf_hair_reflection_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf) | ||||
| { | { | ||||
| #ifdef __HAIR__ | #ifdef __HAIR__ | ||||
| float offset = sc->offset; | float offset = sc->data2; | ||||
| float3 Tg = sc->T; | float3 Tg = sc->T; | ||||
| #else | #else | ||||
| float offset = 0.0f; | float offset = 0.0f; | ||||
| float3 Tg = make_float3(1.0f, 0.0f, 0.0f); | float3 Tg = make_float3(1.0f, 0.0f, 0.0f); | ||||
| #endif | #endif | ||||
| float roughness1 = sc->data0; | float roughness1 = sc->data0; | ||||
| float roughness2 = sc->data1; | float roughness2 = sc->data1; | ||||
| Show All 40 Lines | |||||
| ccl_device float3 bsdf_hair_reflection_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf) | ccl_device float3 bsdf_hair_reflection_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf) | ||||
| { | { | ||||
| return make_float3(0.0f, 0.0f, 0.0f); | return make_float3(0.0f, 0.0f, 0.0f); | ||||
| } | } | ||||
| ccl_device float3 bsdf_hair_transmission_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf) | ccl_device float3 bsdf_hair_transmission_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf) | ||||
| { | { | ||||
| #ifdef __HAIR__ | #ifdef __HAIR__ | ||||
| float offset = sc->offset; | float offset = sc->data2; | ||||
| float3 Tg = sc->T; | float3 Tg = sc->T; | ||||
| #else | #else | ||||
| float offset = 0.0f; | float offset = 0.0f; | ||||
| float3 Tg = make_float3(1.0f, 0.0f, 0.0f); | float3 Tg = make_float3(1.0f, 0.0f, 0.0f); | ||||
| #endif | #endif | ||||
| float roughness1 = sc->data0; | float roughness1 = sc->data0; | ||||
| float roughness2 = sc->data1; | float roughness2 = sc->data1; | ||||
| float Iz = dot(Tg, I); | float Iz = dot(Tg, I); | ||||
| Show All 29 Lines | #endif | ||||
| *pdf = phi_pdf * theta_pdf; | *pdf = phi_pdf * theta_pdf; | ||||
| return make_float3(*pdf, *pdf, *pdf); | return make_float3(*pdf, *pdf, *pdf); | ||||
| } | } | ||||
| ccl_device int bsdf_hair_reflection_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) | ccl_device int bsdf_hair_reflection_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) | ||||
| { | { | ||||
| #ifdef __HAIR__ | #ifdef __HAIR__ | ||||
| float offset = sc->offset; | float offset = sc->data2; | ||||
| float3 Tg = sc->T; | float3 Tg = sc->T; | ||||
| #else | #else | ||||
| float offset = 0.0f; | float offset = 0.0f; | ||||
| float3 Tg = make_float3(1.0f, 0.0f, 0.0f); | float3 Tg = make_float3(1.0f, 0.0f, 0.0f); | ||||
| #endif | #endif | ||||
| float roughness1 = sc->data0; | float roughness1 = sc->data0; | ||||
| float roughness2 = sc->data1; | float roughness2 = sc->data1; | ||||
| float Iz = dot(Tg, I); | float Iz = dot(Tg, I); | ||||
| Show All 38 Lines | #endif | ||||
| } | } | ||||
| return LABEL_REFLECT|LABEL_GLOSSY; | return LABEL_REFLECT|LABEL_GLOSSY; | ||||
| } | } | ||||
| ccl_device int bsdf_hair_transmission_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) | ccl_device int bsdf_hair_transmission_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) | ||||
| { | { | ||||
| #ifdef __HAIR__ | #ifdef __HAIR__ | ||||
| float offset = sc->offset; | float offset = sc->data2; | ||||
| float3 Tg = sc->T; | float3 Tg = sc->T; | ||||
| #else | #else | ||||
| float offset = 0.0f; | float offset = 0.0f; | ||||
| float3 Tg = make_float3(1.0f, 0.0f, 0.0f); | float3 Tg = make_float3(1.0f, 0.0f, 0.0f); | ||||
| #endif | #endif | ||||
| float roughness1 = sc->data0; | float roughness1 = sc->data0; | ||||
| float roughness2 = sc->data1; | float roughness2 = sc->data1; | ||||
| float Iz = dot(Tg, I); | float Iz = dot(Tg, I); | ||||
| ▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines | |||||