[Bf-blender-cvs] [e3461a0] master: Fix T43779: Cycles texture interpolation issues

Sergey Sharybin noreply at git.blender.org
Tue Jul 21 22:18:15 CEST 2015


Commit: e3461a02ac3617ee50a60601ed277b0cb65459ce
Author: Sergey Sharybin
Date:   Tue Jul 21 22:09:52 2015 +0200
Branches: master
https://developer.blender.org/rBe3461a02ac3617ee50a60601ed277b0cb65459ce

Fix T43779: Cycles texture interpolation issues

That was basically not an issue with interpolation, but rather missing wrapping
options and periodic wrapping was always used.

It's still a bit questionable why certain graphics cards were doing clamping in
the file from the report, that's not something what is expected to happen from
the settings of textures being passed to GPU. In any case this issue i still
didn't manage to reproduce on any of the available GPUs, might be something
related on driver glitch or so.

In any case CPU now should behave just fine, rest of the issues we'll need to be
able to reproduce first.

===================================================================

M	intern/cycles/blender/blender_shader.cpp
M	source/blender/editors/space_node/drawnode.c
M	source/blender/makesdna/DNA_node_types.h
M	source/blender/makesrna/intern/rna_nodetree.c

===================================================================

diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index fe7bd76..2942471 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -594,13 +594,13 @@ static ShaderNode *add_node(Scene *scene,
 				        image->filename,
 				        image->builtin_data,
 				        (InterpolationType)b_image_node.interpolation(),
-				        EXTENSION_REPEAT);
+				        (ExtensionType)b_image_node.extension());
 			}
 		}
 		image->color_space = ImageTextureNode::color_space_enum[(int)b_image_node.color_space()];
 		image->projection = ImageTextureNode::projection_enum[(int)b_image_node.projection()];
 		image->interpolation = (InterpolationType)b_image_node.interpolation();
-		image->extension = EXTENSION_REPEAT;
+		image->extension = (ExtensionType)b_image_node.extension();
 		image->projection_blend = b_image_node.projection_blend();
 		get_tex_mapping(&image->tex_mapping, b_image_node.texture_mapping());
 		node = image;
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index fe0e959..e7042b2 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -822,6 +822,8 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA
 		uiItemR(layout, ptr, "projection_blend", 0, "Blend", ICON_NONE);
 	}
 
+	uiItemR(layout, ptr, "extension", 0, "", ICON_NONE);
+
 	/* note: image user properties used directly here, unlike compositor image node,
 	 * which redefines them in the node struct RNA to get proper updates.
 	 */
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 727c7b2..f6875e8 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -727,6 +727,8 @@ typedef struct NodeTexImage {
 	int projection;
 	float projection_blend;
 	int interpolation;
+	int extension;
+	int pad;
 } NodeTexImage;
 
 typedef struct NodeTexChecker {
@@ -975,6 +977,9 @@ typedef struct NodeSunBeams {
 #define SHD_PROJ_EQUIRECTANGULAR	0
 #define SHD_PROJ_MIRROR_BALL		1
 
+#define SHD_IMAGE_EXTENSION_REPEAT	0
+#define SHD_IMAGE_EXTENSION_CLIP	1
+
 /* image texture */
 #define SHD_PROJ_FLAT				0
 #define SHD_PROJ_BOX				1
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 1524715..7fc25f9 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -3557,7 +3557,7 @@ static void def_sh_tex_environment(StructRNA *srna)
 		                       "Projection from an orthographic photo of a mirror ball"},
 		{0, NULL, 0, NULL, NULL}
 	};
-	
+
 	PropertyRNA *prop;
 
 	prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
@@ -3624,6 +3624,12 @@ static void def_sh_tex_image(StructRNA *srna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
+	static EnumPropertyItem prop_image_extension[] = {
+		{SHD_IMAGE_EXTENSION_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"},
+		{SHD_IMAGE_EXTENSION_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
 	PropertyRNA *prop;
 
 	prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
@@ -3656,6 +3662,11 @@ static void def_sh_tex_image(StructRNA *srna)
 	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");
 
+	prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, prop_image_extension);
+	RNA_def_property_ui_text(prop, "Extension", "How the image is extrapolated past its original bounds");
+	RNA_def_property_update(prop, 0, "rna_Node_update");
+
 	prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "iuser");




More information about the Bf-blender-cvs mailing list