Poximal Falloff In A Driver?

Hello All,

I am working on adding a new feature to RE:Array. The ability to use another object to displace the participant in a RE:Array object. As the proximal object approaches the grid of cubes the cubes that are close to the object are displaced from the grid along the Z-Axis.

Three parameters are are available. Range, Strength, Distance. Each cube in the RE:Array has a driver applied to it that calls a function named reviewLOCProximal.


def reviewLOCProximal(range,strength,distance):
    if distance > range:
        result =  0.0
    else:
        result = strength
    return result

While this does work, it only works like a switch. This produces a stiff animation where the displacement can only have two values, On or Off.


I would like to offer some kind of falloff for the new feature set and wondered if anyone know how to calculate a better return value?

Smooth rolloff would be a nice feature. Also any way to add jiggle into the mix might be fun as well.

UPDATE…
With a slight change to the code I get this for a result grid.


def reviewLOCProximal(range,strength,distance):
    result = strength * (distance-range)
    return result


UPDATE Again…
I think I might have stumbled upon something. I added another parameter, falloff, to the mix. If I use the same kind of falloff from a Renderman light shader I get mostly what I am looking for.


def reviewLOCProximal(range,strength,falloff,distance):
    result = strength * range * 1/math.pow(distance,falloff)
    return result


Damns…I can’t remember the name of the algorithm but it’s used in bone envelopes, marching cubes (metaballs) & etc…

Basically it maps the distance to 0.0->1.0 values based on a falloff, once I get another cup of coffee in me hopefully I can remember where I was reading a very good description about it – maybe look up a description on marching cubes?