Hello,
i made custom field based on normal of surface, but i dont understand how can i randomize vectors direction and its magnitude?
when i use vecnoise it gives me 360 degree random but i want control it influens for all axis.
I made foto because havent link to www at work PC.
The simplest way to vary a Normal vector would be to use a TexmapEval operator with a Noise texture map in it.
The TexmapEval has a 3rd output option (besides Color and Mono) which is called NormalPerturb. This is the output normally used to generate Bump Maps in the renderer, by varying the surface Normal at render time.
All you need to do is:
*Feed the Position into the Lookup input of the TexmapEval
*Feed the surface Normal into the Normal input of the TexmapEval
*Add the NormalPerturb output of the TexmapEval to the surface Normal.
This will vary the direction of the Normal. To make it more random, reduce the Map Size, switch the Noise texture to Fractal mode.
To reduce the angle variation, change the second color of the map (white) to darker gray.
To vary the Magnitude, you can simply Multiply the vector by the Abs(olute) of a Noise operator’s output. This will remove the sign and only produce positive values. If Normalize is on, the Noise output will be somewhere between -0.5 and 0.5, Absolute value betwen 0.0 to 0.5, and you can add your own Multiply by Float to scale that range as you want it.
Here are the basic steps:
[size=150]Creating a Field From Mesh Surface Normals[/size]
Here we simply read the Face Normal from the nearest point on the surface, and set each Velocity field sample to point in that direction.
If you want the smooth normal, you would need a FaceQuery operator, but in most cases this should be enough.
The Color visualizes the Vector, in addition to drawing the field as lines.
[size=150]Randomizing The Vector Field Using Noise Texture[/size]
Here we evaluate the Noise texture in a TexmapEval operator, and add its NormalPerturb output to the Vector. Since the input of the texture is the position of the sample and the Normal value it uses, we get a perturbation of the vector that is relative to the coordinate system defined by the Normal, it never goes beyond 90 degrees relative to that direction.
[size=150]Randomizing The Vector Magnitude Using A Noise Operator[/size]
Here we pass through the Add operator so the Noise texture is NOT applied to the result.
We calculate the Absolute value of the Normalized Noise, and multiply it by our own Float value to produce a Magnitude variation by multiplying the Normal with the result of the calculations. We also output the Noise multiplier as Color and see that longer lines are brighter, shorter ones and darker.
[size=150]Randomizing The Vector Magnitude And Direction[/size]
Here we have both working together, one varying the direction, the other varying the Magnitude of each Normal vector stolen from the surface of the mesh.
Thanks Bobo its help.
As i right understand divider of the position control random of the magnitude?7
And if i need that magnitude random not from 0 to 1 and from some value to 1?
It just changes the scale of the Noise because the Noise Operator is cyclic. If the input were a Float, it would repeat the same noise pattern between 0.0 and 1.0, 1.0 and 2.0 etc. Similar with a vector input - the cycle will depend on the world units. Dividing by a floating point number produces a smaller/slower changing input and thus larger variation period within the Field. If you set the divider to 1.0, you will still get variations in the Magnitude, but with a much higher frequency.
This image shows the Divide by 1 vs. Divide by 12.345 - you can see the left looks totally random, while the right shows more of the gradual noise pattern as the scale is larger…
Thanks, for divider understand, but what about second question? How make random of the magnitude not from 0 to 1 and from some value to 1?
You can just add the value you want.
You first get a normalized Noise from 0.0 to around 0.5 (in theory it can go up to 1.0, but usually does not, it depends on the Noise settings).
Then we multiply it by a value, which gives us 0.0 to 0.5 * the Value. Let’s say the Value = 5, then you get 0.0 to about 2.5.
If you would add 1.0 to the Noise before multiplication, it will be from 1.0 to about 1.5, or 5.0 to 7.5 after the multiplication by 5.
If you would add 1.0 after the multiplication, it will go from 1.0 to 3.5…
Simple math, really.
One alternative would be to use a Function > Blend.
Enter the Min. value for socket one.
Enter the Max. value for socket two.
Pipe the unmultiplied Abs. Noise value into socket three.
As the Noise changes between 0.0 and 1.0 (or less), the Blend will produce a value between the Min and the Max values.
Another alternative would be a Function > Curve operator.
You add it behind the Absolute value of the Noise and remap with a curve the range from 0.0 to 1.0 to produce any values you like, in non-linear fashion if you like. Then you can multiply the output of the Curve if you want.
Thaks Bobo, feel myself stupid )))
I need vector direction change in time and i animate phase of the texture, but simulation stay very slow. It have another way to change direction?
The NormalPerturb depends on the GRADIENT of the color - it is largest when the color goes from black to white, and much less pronounced when the change in color is smaller. (It is used for Bump Mapping, so you get an extreme slope where the contrast is high).
So if you want the range of the vector change to be larger, you need to tweak the texture to have more contrast. For example, if using a Noise Map, setting it to Fractal AND lowering the High / increasing the Low thresholds will make the pattern more black&white, and change of the base vector will increase, too. If you want to make the change faster (in addition to stronger), just animate the Phase faster…