Page MenuHome

Force Fields: implement new true power and custom falloff options.
Needs ReviewPublic

Authored by Alexander Gavrilov (angavrilov) on Jun 19 2020, 1:03 PM.

Details

Summary

The 'power' falloff option in Blender force fields does not actually
generate a true power falloff function, as pointed out in D2389.
However, that patch adds a special 'gravity' falloff option to Force
fields, without addressing the shortcoming in the common options.

The reason for not using the true curve in the options, as far as
one can tell, is that the power curve goes up to infinity as the
distance is reduced to 0, while the falloff options are designed
so that the maximum value of the curve is 1.

However, in reality forces with a power falloff don't actually go
to infinity, because real objects have a nonzero size, and the force
reaches its maximum at the surface of the object. This can be used
to integrate an option to use a true power falloff with the design
of falloff settings, if it requires a nonzero 'minimum' distance
to be set, and uses a curve that reaches 1 at that distance.

Since this is adding a new feature to the minimum distance value,
it is also a good opportunity to add a feature to the maximum
distance. Specifically, the new options can be used to apply
arbitrary brush-style falloff curves between min and max,
including a fully custom curve option. When used together with
power falloff, the two curves are multiplied together.

While the true power option allows creating more physically
correct forces, the custom curves aid artistic effects.


Test demonstrating a custom falloff curve - if you press play, the spring-bound rigid body cubes move up according to local force intensity:

Screenshot:

This patch is now included in the experimental build of the temp-angavrilov branch.

Diff Detail

Repository
rB Blender
Branch
temp-angavrilov-force-falloff (branched from master)
Build Status
Buildable 8648
Build 8648: arc lint + arc unit

Event Timeline

Alexander Gavrilov (angavrilov) requested review of this revision.Jun 19 2020, 1:03 PM

Some tweaks and renamed the option.

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

Perhaps cast these two new options to bool here?
So bool instead of int.

I don't see any reason to use int as it seems like they are used as bools either way in the code.

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

I just copied the other similar parameters. Probably the reason they are int is to avoid the need for cast from bit flag to boolean.

If I try the example in https://developer.blender.org/D2389, then toggling the "true power" option and setting a min distance seem to break the simulation

To me it doesn't seem like the particle if affected by the force field anymore.

If I try the example in https://developer.blender.org/D2389, then toggling the "true power" option and setting a min distance seem to break the simulation

You need to increase the force, e.g. if the min distance is 0.1, the force has to be increased to -4/(0.1)^2=-400. In this patch the force is specified at the min radius, while in that old gravity patch at the distance of 1 (and the gravity option does go to infinity too).

Replaced linear falloff checkbox with a dropdown copied from sculpt/paint brushes, including an option to set up a fully custom curve.

Alexander Gavrilov (angavrilov) retitled this revision from Force Fields: implement new true power and linear falloff options. to Force Fields: implement new true power and custom falloff options..Sep 12 2021, 10:16 PM
Alexander Gavrilov (angavrilov) edited the summary of this revision. (Show Details)

Fixed missing check for valid max distance when using custom curves.