From 5078b9d2d08a34ae3786100c2301ea960165e7f2 Mon Sep 17 00:00:00 2001 From: "L. E. Segovia" Date: Wed, 18 Jul 2018 11:14:43 +0200 Subject: Cycles: add Principled Hair BSDF. This is a physically-based, easy-to-use shader for rendering hair and fur, with controls for melanin, roughness and randomization. Based on the paper "A Practical and Controllable Hair and Fur Model for Production Path Tracing". Implemented by Leonardo E. Segovia and Lukas Stockner, part of Google Summer of Code 2018. --- intern/cycles/util/util_math.h | 19 +++++++++++++++++++ intern/cycles/util/util_math_float3.h | 10 ++++++++++ 2 files changed, 29 insertions(+) (limited to 'intern/cycles/util') diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index 85cbd18b7ba..52aeb8d8599 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -55,6 +55,15 @@ CCL_NAMESPACE_BEGIN #ifndef M_2_PI_F # define M_2_PI_F (0.6366197723675813f) /* 2/pi */ #endif +#ifndef M_1_2PI_F +# define M_1_2PI_F (0.1591549430918953f) /* 1/(2*pi) */ +#endif +#ifndef M_SQRT_PI_8_F +# define M_SQRT_PI_8_F (0.6266570686577501f) /* sqrt(pi/8) */ +#endif +#ifndef M_LN_2PI_F +# define M_LN_2PI_F (1.8378770664093454f) /* ln(2*pi) */ +#endif /* Multiplication */ #ifndef M_2PI_F @@ -541,6 +550,16 @@ ccl_device_inline float sqr(float a) return a * a; } +ccl_device_inline float pow20(float a) +{ + return sqr(sqr(sqr(sqr(a))*a)); +} + +ccl_device_inline float pow22(float a) +{ + return sqr(a*sqr(sqr(sqr(a))*a)); +} + ccl_device_inline float beta(float x, float y) { #ifndef __KERNEL_OPENCL__ diff --git a/intern/cycles/util/util_math_float3.h b/intern/cycles/util/util_math_float3.h index 3a5a2ab2244..ba1c117cdea 100644 --- a/intern/cycles/util/util_math_float3.h +++ b/intern/cycles/util/util_math_float3.h @@ -382,6 +382,16 @@ ccl_device_inline bool isequal_float3(const float3 a, const float3 b) #endif } +ccl_device_inline float3 exp3(float3 v) +{ + return make_float3(expf(v.x), expf(v.y), expf(v.z)); +} + +ccl_device_inline float3 log3(float3 v) +{ + return make_float3(logf(v.x), logf(v.y), logf(v.z)); +} + ccl_device_inline int3 quick_floor_to_int3(const float3 a) { #ifdef __KERNEL_SSE__ -- cgit v1.2.3