From 54729df02096da1f3404d4d4891f30752bf90778 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 19 Dec 2012 21:17:16 +0000 Subject: =?UTF-8?q?Cycles=20OSL:=20diffuse=5Ftoon=20and=20specular=5Ftoon?= =?UTF-8?q?=20closures.=20These=20are=20toon=20shaders=20with=20a=20size?= =?UTF-8?q?=20parameter=20between=200.0=20and=201.0=20that=20gives=20a=20a?= =?UTF-8?q?ngle=20of=20reflection=20between=200=C2=B0=20and=2090=C2=B0,=20?= =?UTF-8?q?and=20a=20smooth=20parameter=20that=20gives=20and=20angle=20ove?= =?UTF-8?q?r=20which=20a=20smooth=20transition=20from=20full=20to=20no=20r?= =?UTF-8?q?eflection=20happens.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These work with global illumination and do importance sampling of the area within the angle. Note that unlike most other BSDF's these are not energy conserving in general, in particular if their weight is 1.0 and size > 2/3 (or 60°) they will add more energy in each bounce. Diffuse: http://www.pasteall.org/pic/show.php?id=42119 Specular: http://www.pasteall.org/pic/show.php?id=42120 --- intern/cycles/kernel/svm/svm_math.h | 67 ------------------------------------- 1 file changed, 67 deletions(-) (limited to 'intern/cycles/kernel/svm/svm_math.h') diff --git a/intern/cycles/kernel/svm/svm_math.h b/intern/cycles/kernel/svm/svm_math.h index db3b8d3f763..c7cd5200cd0 100644 --- a/intern/cycles/kernel/svm/svm_math.h +++ b/intern/cycles/kernel/svm/svm_math.h @@ -18,73 +18,6 @@ CCL_NAMESPACE_BEGIN -__device float safe_asinf(float a) -{ - if(a <= -1.0f) - return -M_PI_2_F; - else if(a >= 1.0f) - return M_PI_2_F; - - return asinf(a); -} - -__device float safe_acosf(float a) -{ - if(a <= -1.0f) - return M_PI_F; - else if(a >= 1.0f) - return 0.0f; - - return acosf(a); -} - -__device float compatible_powf(float x, float y) -{ - /* GPU pow doesn't accept negative x, do manual checks here */ - if(x < 0.0f) { - if(fmod(-y, 2.0f) == 0.0f) - return powf(-x, y); - else - return -powf(-x, y); - } - else if(x == 0.0f) - return 0.0f; - - return powf(x, y); -} - -__device float safe_powf(float a, float b) -{ - if(b == 0.0f) - return 1.0f; - if(a == 0.0f) - return 0.0f; - if(a < 0.0f && b != (int)b) - return 0.0f; - - return compatible_powf(a, b); -} - -__device float safe_logf(float a, float b) -{ - if(a < 0.0f || b < 0.0f) - return 0.0f; - - return logf(a)/logf(b); -} - -__device float safe_divide(float a, float b) -{ - float result; - - if(b == 0.0f) - result = 0.0f; - else - result = a/b; - - return result; -} - __device float svm_math(NodeMath type, float Fac1, float Fac2) { float Fac; -- cgit v1.2.3