Commit: 940fd87e77b65a698ea9826191cf5a03c1eaf8f1 Author: Philipp Oeser Date: Wed Jan 4 10:33:40 2023 +0100 Branches: master https://developer.blender.org/rB940fd87e77b65a698ea9826191cf5a03c1eaf8f1
Fix T103615: OSL image box mapping has flipped textures This breaks backwards compatibility some in that 3 sides will be mapped differently now, but difficult to avoid and can be considered a bugfix. Similar to rBdd8016f7081f. Maniphest Tasks: T103615 Differential Revision: https://developer.blender.org/D16910 =================================================================== M intern/cycles/kernel/osl/shaders/node_image_texture.osl =================================================================== diff --git a/intern/cycles/kernel/osl/shaders/node_image_texture.osl b/intern/cycles/kernel/osl/shaders/node_image_texture.osl index 991fb9d161e..1a4f351d1da 100644 --- a/intern/cycles/kernel/osl/shaders/node_image_texture.osl +++ b/intern/cycles/kernel/osl/shaders/node_image_texture.osl @@ -122,6 +122,7 @@ shader node_image_texture(int use_mapping = 0, vector Nob = transform("world", "object", N); /* project from direction vector to barycentric coordinates in triangles */ + vector signed_Nob = Nob; Nob = vector(fabs(Nob[0]), fabs(Nob[1]), fabs(Nob[2])); Nob /= (Nob[0] + Nob[1] + Nob[2]); @@ -184,9 +185,10 @@ shader node_image_texture(int use_mapping = 0, float tmp_alpha; if (weight[0] > 0.0) { + point UV = point((signed_Nob[0] < 0.0) ? 1.0 - p[1] : p[1], p[2], 0.0); Color += weight[0] * image_texture_lookup(filename, - p[1], - p[2], + UV[0], + UV[1], tmp_alpha, compress_as_srgb, ignore_alpha, @@ -198,9 +200,10 @@ shader node_image_texture(int use_mapping = 0, Alpha += weight[0] * tmp_alpha; } if (weight[1] > 0.0) { + point UV = point((signed_Nob[1] > 0.0) ? 1.0 - p[0] : p[0], p[2], 0.0); Color += weight[1] * image_texture_lookup(filename, - p[0], - p[2], + UV[0], + UV[1], tmp_alpha, compress_as_srgb, ignore_alpha, @@ -212,9 +215,10 @@ shader node_image_texture(int use_mapping = 0, Alpha += weight[1] * tmp_alpha; } if (weight[2] > 0.0) { + point UV = point((signed_Nob[2] > 0.0) ? 1.0 - p[1] : p[1], p[0], 0.0); Color += weight[2] * image_texture_lookup(filename, - p[1], - p[0], + UV[0], + UV[1], tmp_alpha, compress_as_srgb, ignore_alpha, _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
