Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Yurkovich <jesse.y@gmail.com>2022-01-26 09:00:23 +0300
committerJesse Yurkovich <jesse.y@gmail.com>2022-01-26 09:00:23 +0300
commit46ae083113487d88a8cce8fc3ee38839e2ebd070 (patch)
treea73b1313d537c16c9bafd90081a2d01a7f8f60b9
parentb06fff4737e5a18bb999f6633c7df67dda63ace7 (diff)
Fix: OSL not recognizing UVTILE images
The OSL image compilation step needed to be taught about the new UVTILE format for UDIM textures. A small missing feature from OIIO[1] means this is a bit uglier than it needs to be. Once we update to a version of OIIO with the fix we can remove the string replace part. [1] https://github.com/OpenImageIO/oiio/commit/35cb6a83e28d77bd9eb30e153abd9df4248863c5 Differential Revision: https://developer.blender.org/D13912
-rw-r--r--intern/cycles/scene/shader_nodes.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/intern/cycles/scene/shader_nodes.cpp b/intern/cycles/scene/shader_nodes.cpp
index 7f3625c0c69..34675be8e80 100644
--- a/intern/cycles/scene/shader_nodes.cpp
+++ b/intern/cycles/scene/shader_nodes.cpp
@@ -32,6 +32,7 @@
#include "util/color.h"
#include "util/foreach.h"
#include "util/log.h"
+#include "util/string.h"
#include "util/transform.h"
#include "kernel/tables.h"
@@ -462,8 +463,12 @@ void ImageTextureNode::compile(OSLCompiler &compiler)
const ustring known_colorspace = metadata.colorspace;
if (handle.svm_slot() == -1) {
+ /* OIIO currently does not support <UVTILE> substitutions natively. Replace with a format they
+ * understand. */
+ std::string osl_filename = filename.string();
+ string_replace(osl_filename, "<UVTILE>", "<U>_<V>");
compiler.parameter_texture(
- "filename", filename, compress_as_srgb ? u_colorspace_raw : known_colorspace);
+ "filename", ustring(osl_filename), compress_as_srgb ? u_colorspace_raw : known_colorspace);
}
else {
compiler.parameter_texture("filename", handle.svm_slot());
@@ -472,7 +477,8 @@ void ImageTextureNode::compile(OSLCompiler &compiler)
const bool unassociate_alpha = !(ColorSpaceManager::colorspace_is_data(colorspace) ||
alpha_type == IMAGE_ALPHA_CHANNEL_PACKED ||
alpha_type == IMAGE_ALPHA_IGNORE);
- const bool is_tiled = (filename.find("<UDIM>") != string::npos);
+ const bool is_tiled = (filename.find("<UDIM>") != string::npos ||
+ filename.find("<UVTILE>") != string::npos);
compiler.parameter(this, "projection");
compiler.parameter(this, "projection_blend");