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:
authorMartijn Berger <martijn.berger@gmail.com>2014-03-08 02:16:09 +0400
committerMartijn Berger <martijn.berger@gmail.com>2014-03-08 02:16:33 +0400
commitdd2dca2f7e77e7521d13b78e875ffa58a90846f2 (patch)
tree26c0d371fbca7eb25e9060aabc5ef6fe56939cf2 /source/blender
parentef51b690090967f5576b88a528a79c5defb1ddd4 (diff)
Add support for multiple interpolation modes on cycles image textures
All textures are sampled bi-linear currently with the exception of OSL there texture sampling is fixed and set to smart bi-cubic. This patch adds user control to this setting. Added: - bits to DNA / RNA in the form of an enum for supporting multiple interpolations types - changes to the image texture node drawing code ( add enum) - to ImageManager (this needs to know to allocate second texture when interpolation type is different) - to node compiler (pass on interpolation type) - to device tex_alloc this also needs to get the concept of multiple interpolation types - implementation for doing non interpolated lookup for cuda and cpu - implementation where we pass this along to osl ( this makes OSL also do linear untill I add smartcubic to the interface / DNA/ RNA) Reviewers: brecht, dingto Reviewed By: brecht CC: dingto, venomgfx Differential Revision: https://developer.blender.org/D317
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_node/drawnode.c1
-rw-r--r--source/blender/makesdna/DNA_node_types.h8
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c16
3 files changed, 24 insertions, 1 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index effb8eb7de5..0cdb17cb2d4 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -784,6 +784,7 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
uiItemR(layout, ptr, "projection", 0, "", ICON_NONE);
+ uiItemR(layout, ptr, "interpolation", 0, "", ICON_NONE);
if (RNA_enum_get(ptr, "projection") == SHD_PROJ_BOX) {
uiItemR(layout, ptr, "projection_blend", 0, "Blend", ICON_NONE);
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index cd9595d8185..1ad713e64e0 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -724,7 +724,7 @@ typedef struct NodeTexImage {
int color_space;
int projection;
float projection_blend;
- int pad;
+ int interpolation;
} NodeTexImage;
typedef struct NodeTexChecker {
@@ -951,6 +951,12 @@ typedef struct NodeShaderNormalMap {
#define SHD_PROJ_FLAT 0
#define SHD_PROJ_BOX 1
+/* image texture interpolation */
+#define SHD_INTER_LINEAR 0
+#define SHD_INTER_CLOSEST 1
+#define SHD_INTER_CUBIC 2
+#define SHD_INTER_SMART 3
+
/* tangent */
#define SHD_TANGENT_RADIAL 0
#define SHD_TANGENT_UVMAP 1
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index d893a8c21f9..ae7dcdac423 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -3428,6 +3428,17 @@ static void def_sh_tex_image(StructRNA *srna)
{0, NULL, 0, NULL, NULL}
};
+ static const EnumPropertyItem prop_interpolation_items[] = {
+ {SHD_INTER_LINEAR, "Linear", 0, "Linear",
+ "Linear interpolation"},
+ {SHD_INTER_CLOSEST, "Closest", 0, "Closest",
+ "No interpolation (sample closest texel"},
+ {SHD_INTER_CUBIC, "Cubic", 0, "Cubic",
+ "Cubic interpolation (OSL only)"},
+ {SHD_INTER_SMART, "Smart", 0, "Smart",
+ "Bicubic when maxifying, else bilinear (OSL only)"},
+ {0, NULL, 0, NULL, NULL}
+ };
PropertyRNA *prop;
@@ -3451,6 +3462,11 @@ static void def_sh_tex_image(StructRNA *srna)
RNA_def_property_ui_text(prop, "Projection", "Method to project 2D image on object with a 3D texture vector");
RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_interpolation_items);
+ RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
prop = RNA_def_property(srna, "projection_blend", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_ui_text(prop, "Projection Blend", "For box projection, amount of blend to use between sides");
RNA_def_property_update(prop, 0, "rna_Node_update");