I’m trying to apply set my density based on the inverse of my velocity ( particles moving slower are more dense ). I’ve divided the velocity chanel by 1, then multiplied the result by .000001 to get the values back into a 0-1 range to output to density. No matter what I do I can’t seem to get a good 0-1 range to apply to the density. I’ve tried using Curves , different multiplication values, etc
Is there a better way to do this? Is there a way to map a range to 0-1 ( like a auto-gain in fusion )?
I find these things are easier to tackle if you focus on the edge cases. For example, what do you want the density to be when a particle is motionless? By your original formula:
Density = 1.0 / Velocity.Magnitude (ie. Density = inverse Velocity).
If the particle has Velocity 0, you are going to get 1.0 / 0 = Infinity which Krakatoa isn’t going to handle particularly well. In particular, as the Velocity approaches 0, the Density will be getting larger and larger.
Auto-gain in fusion searches each pixel for the maximum value, then divides the entire image by that maximum value in a second pass through all pixels. There is no mechanism in KCMs for this, so you need to pick a maximum value yourself.
In the curve operator in the Density KCM. If I input .00001 ( I don’t want the density going to zero ) it snaps to zero. The lowest I can go is 3 decimal places even though I have set my decimal to 7 places in my max preferences.
The fields for entering the X and Y of the points are hard-coded in the Curve control and are not affected by the Max settings.
But there is a workaround you could try - it seems to work here.
Click the >> button next to the Preset field and save a new preset. Remember its name.
In the MagmaFlow File menu, select “Explore Flows Folders…”, then move one folder up and into \MagmaFlowSettings
Open the file CurveControlPresets.ini and locate the line containing the preset you just saved.
Each sub-element of the array is a point definition - change the values you want, for example
Preset7=#(#([0,0.00001], [0,0], [0,0], false, true), #([1,1], [0,0], [0,0], false, true))
5. Save the file, then in the Curve operator, press the >> button again and select the Preset name to load
RESULT: The preset will be loaded with the modified settings and when I run in Debug mode, I can see the value being 1e-005