[Bf-committers] particle + mirror modifier bug

Brecht Van Lommel brechtvanlommel at gmail.com
Mon May 28 13:59:18 CEST 2018


Hi,

By default for hair, it is attached to the original mesh before modifier
stack evaluation, referencing one of the faces in the original mesh. The
advice is generally to apply the mirror modifier before starting hair
editing.

In your file the "Use Modifier Stack" option is enabled, which attaches the
hair to the mesh after modifier evaluation. This makes it work for the
mirror modifier (but will not work so well in other cases like subsurf
which is why the option is off by default).

The bug seems to be that the disconnect/reconnect hair operator does not
take into account this "Use Modifier Stack" setting, in that case it should
use the final mesh instead of the deformed (original) mesh.

Regards,
Brecht.




On Sun, May 27, 2018 at 7:35 PM, Oliver Mangold <o.mangold at gmail.com> wrote:

> Hi,
>
> I would like to fix a bug, concerning disconnect/reconnect of hairs on an
> object with a mirror modifier. I already reported it (
> https://developer.blender.org/T54488), but now I also dug a little into
> the relevant code. My findings are, that in the function
> remap_hair_emitter(), which does the main work of reconnecting hair to the
> mesh, there is a weird case decision
>
>         if (target_psmd->dm_final->deformedOnly) {
>                 /* we don't want to mess up target_psmd->dm when
> converting to global coordinates below */
>                 dm = target_psmd->dm_final;
>         }
>         else {
>                 dm = target_psmd->dm_deformed;
>         }
>
> where in my tests the second branch is taken, thus dm_deformed is used for
> the further steps, in particular to build the BVH which is used to search
> for the nearest face to connect the a hair to.
>
>                 bvhtree_from_mesh_get(&bvhtree, dm, BVHTREE_FROM_FACES,
> 2);
>
> It seems that in dm_final the mirrored faces are present, while in
> dm_deformed they are not. Thus was happens is, that the hair on the
> mirrored side get connected to the nearest point of the nearest unmirrored
> face. The problem goes away when removing the case decision and always
> using dm_final. Checking the history, once it worked that way, and was
> changed to the current situation in this commit:
>
> commit 0666de06f3119ff1640f1eb66833cd4feb669209
> Date:   Thu Jan 15 18:15:52 2015 +0100
>
>     Fix for particle system copy: This has to make sure the ORIGSPACE data
>     layer is available.
>
>     Otherwise particle mapping to the new mesh cannot work with subdivided
>     and constructively-modified meshes.
>
> I have to admit, that I got lost at that point. I'm not familiar enough
> with the code yet, to understand what really is the idea behind selecting
> dm_final or dm_deformed, and what problem exactly was fixed by that. Would
> be great if someone could explain. How can this bug be fixed without
> breaking the fix of the commit above?
>
> Best regards,
>
> O.
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> https://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list