diff options
author | Thomas Dinges <blender@dingto.org> | 2013-06-11 01:55:41 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2013-06-11 01:55:41 +0400 |
commit | 9020df976ca37104a36a90d43c6e5b33c24cdbd2 (patch) | |
tree | 8ce649d25f4de2f84b340a9d8328ef39ed8b2851 /intern/cycles/kernel/svm/svm_mix.h | |
parent | c03e638cf310cde57ede10d3d9c90aecce007b15 (diff) | |
parent | cf359f6c7f259bf669a144c9a455fe79780fc6ff (diff) |
Cycles / Wavelength to RGB node:
* Added a node to convert wavelength (in nanometers, from 380nm to 780nm) to RGB values. This can be useful to match real world colors easier.
* Code cleanup:
** Moved color functions (xyz and hsv) into dedicated utility files.
** Remove svm_lerp(), use interp() instead.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/More#Wavelength
Example render:
http://www.pasteall.org/pic/show.php?id=53202
This is part of my GSoC 2013. (revisions 57322, 57326, 57335 and 57367 from soc-2013-dingto).
Diffstat (limited to 'intern/cycles/kernel/svm/svm_mix.h')
-rw-r--r-- | intern/cycles/kernel/svm/svm_mix.h | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/intern/cycles/kernel/svm/svm_mix.h b/intern/cycles/kernel/svm/svm_mix.h index 888e4d9645e..d6a306af64d 100644 --- a/intern/cycles/kernel/svm/svm_mix.h +++ b/intern/cycles/kernel/svm/svm_mix.h @@ -16,28 +16,21 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "svm_hsv.h" - CCL_NAMESPACE_BEGIN -__device float3 svm_lerp(const float3 a, const float3 b, float t) -{ - return (a * (1.0f - t) + b * t); -} - __device float3 svm_mix_blend(float t, float3 col1, float3 col2) { - return svm_lerp(col1, col2, t); + return interp(col1, col2, t); } __device float3 svm_mix_add(float t, float3 col1, float3 col2) { - return svm_lerp(col1, col1 + col2, t); + return interp(col1, col1 + col2, t); } __device float3 svm_mix_mul(float t, float3 col1, float3 col2) { - return svm_lerp(col1, col1 * col2, t); + return interp(col1, col1 * col2, t); } __device float3 svm_mix_screen(float t, float3 col1, float3 col2) @@ -75,7 +68,7 @@ __device float3 svm_mix_overlay(float t, float3 col1, float3 col2) __device float3 svm_mix_sub(float t, float3 col1, float3 col2) { - return svm_lerp(col1, col1 - col2, t); + return interp(col1, col1 - col2, t); } __device float3 svm_mix_div(float t, float3 col1, float3 col2) @@ -93,7 +86,7 @@ __device float3 svm_mix_div(float t, float3 col1, float3 col2) __device float3 svm_mix_diff(float t, float3 col1, float3 col2) { - return svm_lerp(col1, fabs(col1 - col2), t); + return interp(col1, fabs(col1 - col2), t); } __device float3 svm_mix_dark(float t, float3 col1, float3 col2) @@ -191,7 +184,7 @@ __device float3 svm_mix_hue(float t, float3 col1, float3 col2) hsv.x = hsv2.x; float3 tmp = hsv_to_rgb(hsv); - outcol = svm_lerp(outcol, tmp, t); + outcol = interp(outcol, tmp, t); } return outcol; @@ -238,7 +231,7 @@ __device float3 svm_mix_color(float t, float3 col1, float3 col2) hsv.y = hsv2.y; float3 tmp = hsv_to_rgb(hsv); - outcol = svm_lerp(outcol, tmp, t); + outcol = interp(outcol, tmp, t); } return outcol; |