Page MenuHome

Fix T71745: "When hair emitter's 'Curve Guide' Field Weight lies between 0 and 1, strands float toward origin."
Needs ReviewPublic

Authored by tim (teedotbee) on Sat, Nov 23, 12:13 AM.

Details

Summary

Bug description: https://developer.blender.org/T71745

Although NON-hair particles' Field Weights are yet to be normalized, you will find even their behavior superior to before. Hair particles' work perfectly.

Diff Detail

Event Timeline

tim (teedotbee) edited the summary of this revision. (Show Details)Sat, Nov 23, 12:15 AM
Habib Gahbiche (zazizizou) retitled this revision from Fix "When hair emitter's 'Curve Guide' Field Weight lies between 0 and 1, strands float toward origin." to Fix T71745: "When hair emitter's 'Curve Guide' Field Weight lies between 0 and 1, strands float toward origin.".
  • Changed related task
  • Added task number to title. Tip: when the title of the revision/commit starts with 'Fix TXXXX' the bug will automatically get closed when the patch is commited
  • Added reviewer to task
source/blender/blenkernel/intern/particle.c
2108
  1. Coding style: Comments should always start with a capital letter and end with a full stop. See https://wiki.blender.org/wiki/Style_Guide/C_Cpp for more details about style.
  1. What's with the todo? Is this still a work in progress patch or is the todo meant as a nice to have (unrelated) feature?
source/blender/blenkernel/intern/particle.c
2108

Re: 1, Thank you, revised!
Re: 2, Selectively to normalize one type of particles' field weights seems nontrivial--the function as yet does not distinguish between hair and non-hair--So I'd like to leave it to someone more experienced. The bug is indeed, however, fixed!

While this does seem to solve the issue in your particular case, I'm not sure if this is a general solution. I don't fully understand this function yet, but the totstrength seems to be handled in weird ways. Especially, when there is more than one guide curve (not sure what's the use case for this).

I've never used curve guides myself before, so I'm also a bit guessing with what is supposed to happen...

I need some more time to understand this function more deeply...

This simple file still does not behave as I'd expect with your patch (when changing the influence of the Curve Guide).

tim (teedotbee) added a comment.EditedSun, Nov 24, 12:36 AM

@Jacques Lucke (JacquesLucke) Very good point. Took another look:

Severity of remaining issue scales with the displacement between curve Object Origin[1] and strand base. Neither vec_to_point nor guidevec concern said Object Origin: mere curve base determines both[2]. In fact, no variable in this function uses curve Object Origin. I suspect the issue, then, lies further upstream in the code for eff itself. Does this seem sensible?

The solution, naturally, would be to remove Object Origin's influence on behavior full stop.

footnotes:
1. Significantly not curve base. Note how when the curve's Object Origin lies at the strand base like in the first image below, Field Weight behavior is correct no matter where the curve itself is.
2. guidevec is the displacement between global origin and curve base; vec_to_point between curve base and strand base. Adding these together is how the function determines root position on line 2104. See second image below.