Skip to content

Instantly share code, notes, and snippets.

@JokerMartini
Created July 31, 2015 17:55
Show Gist options
  • Save JokerMartini/50e20375c0a762fe1c86 to your computer and use it in GitHub Desktop.
Save JokerMartini/50e20375c0a762fe1c86 to your computer and use it in GitHub Desktop.
Maxscript: This function demonstrates how to implement a simple 'bias' control to weight values towards one direction versus the other.
-- biasStrength : range:[-1,1,0]
-- biasPower : range:[1,100,0]
fn CalculateBias val:0.0 bias:0.0 biasPower:1 =
(
if bias < 0 then 1 - (pow (1 - val) (1 - biasPower*bias)) else (pow val (1 + biasPower * bias))
)
fn BiasTest =
(
count = 20
height = 10
strength = .5
power = 9
for k = 0.0 to count-1 do
(
f = k / (count-1.0)
posZ = CalculateBias val:f bias:strength biasPower:power
posZ *= height
point pos:[0,0,posZ] wirecolor:green size:1
)
)
delete objects
BiasTest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment