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.
This commit is contained in:
parent
8cc4f3f52a
commit
7ecc159f37
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user