diff options
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r-- | intern/cycles/blender/blender_mesh.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 11 | ||||
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 22 |
3 files changed, 30 insertions, 5 deletions
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index de594f4fb6c..1b47c4123e3 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include "render/colorspace.h" #include "render/mesh.h" #include "render/object.h" #include "render/scene.h" @@ -301,6 +302,7 @@ static void create_mesh_volume_attribute( INTERPOLATION_LINEAR, EXTENSION_CLIP, use_alpha, + u_colorspace_raw, metadata); } diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 3a7e5f02b1d..c50dbb6ba55 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -16,12 +16,13 @@ #include <stdlib.h> +#include "device/device.h" #include "render/background.h" #include "render/buffers.h" #include "render/camera.h" -#include "device/device.h" -#include "render/integrator.h" +#include "render/colorspace.h" #include "render/film.h" +#include "render/integrator.h" #include "render/light.h" #include "render/mesh.h" #include "render/object.h" @@ -1158,6 +1159,12 @@ void BlenderSession::builtin_image_info(const string &builtin_name, metadata.height = b_image.size()[1]; metadata.depth = 1; metadata.channels = b_image.channels(); + + if (metadata.is_float) { + /* Float images are already converted on the Blender side, + * no need to do anything in Cycles. */ + metadata.colorspace = u_colorspace_raw; + } } else if (b_id.is_a(&RNA_Object)) { /* smoke volume data */ diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index d1f823bc2b8..e6ec8b22d7a 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -15,6 +15,7 @@ */ #include "render/background.h" +#include "render/colorspace.h" #include "render/graph.h" #include "render/light.h" #include "render/nodes.h" @@ -665,7 +666,14 @@ static ShaderNode *add_node(Scene *scene, } #endif } - image->color_space = (NodeImageColorSpace)b_image_node.color_space(); + switch (b_image_node.color_space()) { + case BL::ShaderNodeTexImage::color_space_NONE: + image->colorspace = u_colorspace_raw; + break; + case BL::ShaderNodeTexImage::color_space_COLOR: + image->colorspace = u_colorspace_auto; + break; + } image->projection = (NodeImageProjection)b_image_node.projection(); image->interpolation = get_image_interpolation(b_image_node); image->extension = get_image_extension(b_image_node); @@ -710,7 +718,14 @@ static ShaderNode *add_node(Scene *scene, } #endif } - env->color_space = (NodeImageColorSpace)b_env_node.color_space(); + switch (b_env_node.color_space()) { + case BL::ShaderNodeTexEnvironment::color_space_NONE: + env->colorspace = u_colorspace_raw; + break; + case BL::ShaderNodeTexEnvironment::color_space_COLOR: + env->colorspace = u_colorspace_auto; + break; + } env->interpolation = get_image_interpolation(b_env_node); env->projection = (NodeEnvironmentProjection)b_env_node.projection(); BL::TexMapping b_texture_mapping(b_env_node.texture_mapping()); @@ -861,7 +876,8 @@ static ShaderNode *add_node(Scene *scene, point_density->builtin_data, point_density->interpolation, EXTENSION_CLIP, - true); + true, + u_colorspace_raw); } node = point_density; |