Pivot Painter - Understanding Values corretly

spaceharry:

I think what you’re seeing there is that you’re using a the Z falloff in the custom alpha control area. The X Y and Z sliders will brighten the meshes extremities on a given axis. Basically, it adds symmetrical gradients for a chosen axis.

You may want to use the 3d dist to pivot option instead. That will keep the root still while animating the top of the cylinder if used to modulate the rotate about axis angle input.

The color preview indicates which direction the X axis is pointing. For your cylinder you probably want to point your x axis upward. The alpha controls don’t affect that value. It should probably be labeled axis preview or something instead of color.

I wouldn’t think about stored information in terms of degrees. You should instead think of it as a vector. All of the operations we’re doing is based in vector math. So the value you store is the x axis vector. When we find a rotation axis we use cross products to find perpendicular vectors or we make use of the dot product operation to find gradients along a vector or to determine if vectors are facing each other.

Sorry, I’m not sure what this is in reference to. Values like 128 or 256 in these materials are generally just random values used to encapsulate the given models within the 0-1 range of a distance calculation or two change a textures tiling frequency.

So i think we are talking about example 1.17 “Rotate_PerObjectPivot_wind_DirectionalAnimation”.

It works in the following way (i’ll explain the individual chunks):

Create the rotation angle from the wind direction

We find the rotation vector by getting the cross product of the models x-axis vector (up for these examples) and the wind vector (positive x in this example). The result is negative y or (0,-1,0). We do it this way because it allows us to rotate models or place models at different angles while still allowing them to be affected by the wind correctly. Had we used a fixed rotate about axis vector all of the models would have to be rotated in the same direction.

Whenever you’re confused about the math I would recommend using the debugfloat3Values material function. It will display the resulting values for you.

Create world flow gradients

We take the dot product of the wind direction and the pivot position to return a gradient value that increments upward in the direction of the wind.

Each box returns 1 solid value across it’s entire surface because the dot product references the boxes pivot positions instead of world position (vertex position).

We also take the dot product of the wind with the cross product of the wind direction and the up vector. This returns a gradient the negative y vector again. We do this to get a gradient that’s 90 degrees off from the first gradient that we calculated. When combining the two gradients together using the append function we retrieve values that are similar to UV values which can be used for a texture. Which is what we’re creating in the next step.

52b0cddcb0177adc95499409700f5bf29d3b5760.jpeg
We divide the “uv” style gradients by a large amount to reduce the texture tiling, animate them via time and pump the values into the uv slot of a texture.

**Add the DOT product result to the previous animation to offset it
**
f065b7ae3cae6a7885ec11b840bf24f26297109d.jpeg

Unfortunately, it looks like this comment was left over from a previous material. Regardless, in this step we’re just remapping the texture values to our liking for the rotate about axis operation.

6b1dc3851b32fdb144deac8d967c8a40cc9aafa9.jpeg

Rotate the sub-models

Then we just rotate the models using the axis that created earlier and the rescaled texture values as the angle.


As an additional step, we calculate new normal values for the boxes using the same angle and axis from the previous rotate about axis node but this time we’re using the node called fixrotateaboutaxisnormals.

Hope that helps.