[Bf-blender-cvs] [7ecc159] master: Force Fields: Fix Texture with both Use Coordinates and 2D enabled.

Alexander Gavrilov noreply at git.blender.org
Fri May 6 11:07:02 CEST 2016


Commit: 7ecc159f378e5bddfdb7aae8ac7784d3ca3f87fc
Author: Alexander Gavrilov
Date:   Mon Apr 18 18:45:34 2016 +0300
Branches: master
https://developer.blender.org/rB7ecc159f378e5bddfdb7aae8ac7784d3ca3f87fc

Force Fields: Fix Texture with both Use Coordinates and 2D enabled.

>From description, Use Coordinates evaluates the texture using
target coordinates in the local space of the force field object.
2D is supposed to ignore the Z coordinate. Thus one would assume
that if both are enabled, the force field effect would move with
the force field object, and Z would be 0.

However, instead first the 2D option projects points onto a plane
passing through the global zero and orthogonal to the local Z,
and only then the resulting point is transformed into local space.
Z is not locked at 0, so procedural textures like Spherical Blend
don't work as expected.

To fix this, apply local transform first, and then just clear Z if 2D.

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

M	source/blender/blenkernel/intern/effect.c

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

diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 12bce70..6284b3a 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -746,13 +746,15 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
 
 	copy_v3_v3(tex_co, point->loc);
 
-	if (eff->pd->flag & PFIELD_TEX_2D) {
-		float fac=-dot_v3v3(tex_co, efd->nor);
-		madd_v3_v3fl(tex_co, efd->nor, fac);
-	}
-
 	if (eff->pd->flag & PFIELD_TEX_OBJECT) {
 		mul_m4_v3(eff->ob->imat, tex_co);
+
+		if (eff->pd->flag & PFIELD_TEX_2D)
+			tex_co[2] = 0.0f;
+	}
+	else if (eff->pd->flag & PFIELD_TEX_2D) {
+		float fac=-dot_v3v3(tex_co, efd->nor);
+		madd_v3_v3fl(tex_co, efd->nor, fac);
 	}
 
 	scene_color_manage = BKE_scene_check_color_management_enabled(eff->scene);




More information about the Bf-blender-cvs mailing list