[Bf-blender-cvs] [ecdc2f7108b] upstream_cycles_texture_cache: Ccyles: texture differentials now respect the hidden mapping node inside the image texture node.

Stefan Werner noreply at git.blender.org
Wed Jun 27 14:05:10 CEST 2018


Commit: ecdc2f7108b5960de163b220dc83291e35c3fa89
Author: Stefan Werner
Date:   Wed Aug 2 20:40:27 2017 +0200
Branches: upstream_cycles_texture_cache
https://developer.blender.org/rBecdc2f7108b5960de163b220dc83291e35c3fa89

Ccyles: texture differentials now respect the hidden mapping node inside the image texture node.

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

M	intern/cycles/render/graph.cpp

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

diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index 7461f41e002..90b95ebefdd 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -930,8 +930,19 @@ void ShaderGraph::add_differentials()
 			ShaderOutput *out_dx = nodes_dx[out->parent]->output(out->name());
 			ShaderOutput *out_dy = nodes_dy[out->parent]->output(out->name());
 
-			connect(out_dx, node->input("Vector_dx"));
-			connect(out_dy, node->input("Vector_dy"));
+			/* Insert mapping nodes that are duplicates of what's inside the image node.
+			 * This is somewhat wasteful, it would be better to have a MappingNode
+			 * that does three transforms at a time. */
+			MappingNode *mapping1 = new MappingNode;
+			MappingNode *mapping2 = new MappingNode;
+			mapping1->tex_mapping = ((ImageTextureNode*)node)->tex_mapping;
+			mapping2->tex_mapping = ((ImageTextureNode*)node)->tex_mapping;
+			add(mapping1);
+			add(mapping2);
+			connect(out_dx, mapping1->input("Vector"));
+			connect(out_dy, mapping2->input("Vector"));
+			connect(mapping1->output("Vector"), node->input("Vector_dx"));
+			connect(mapping2->output("Vector"), node->input("Vector_dy"));
 
 			/* add generated nodes */
 			foreach(NodePair& pair, nodes_dx)



More information about the Bf-blender-cvs mailing list