[Closed] Get vertex colour from Gradient Ramp
I鈥檝e got an animated gradient ramp black/white (solid interpolation) and I want to trigger an animation when the face changes from black to white. So what I want to do is keep an array of all the vertices, then when they change to white then trigger some code.
Can鈥檛 seem to work out how I convert the vertex position to UV space and then get the rgb value of that point in uv space鈥?I鈥檓 sure I鈥檝e done it before but forgotten it seems.
And another small question, how do I convert a normalized vector into a $.rotation value?
hi
try this
fn GetVectorsAngle v1 v2 =
(
theAngle = acos(dot (normalize v1) (normalize v2))
)
GetVectorsAngle [10,0,0] [10,20,0]
arbAxis <point3>
Returns a Matrix3 value representing an arbitrary axis system using point3 as the 鈥渦p鈥?direction.
matrixFromNormal <point3>
Returns a Matrix3 value with the normal specified by the given point as the Z axis. The translation portion of the Matrix3 value will be [0,0,0]. The components of the scale portion are the inverse of the values required to normalize the point3 value. [left][left]
[/left]
[/left]
Surely a normalized vector is a direction? Or have I got my understanding of vector math completely wrong? doesn鈥檛 it take 0,0,0 as a base and that gives you a direction?
b = polyop.getfacenormal $ 1
returns a value of [0.370587,-0.806068,0.461432]
I鈥檓 confused how I convert this to a quat value so when I create a Point helper I can write鈥?br>
Point pos:0,0,0 rotation:b
It is a direction, however direction or .dir expects and returns a point3 value. After creating the Point set its .dir property to the normal. Or you could use MaxtrixFromNormal to convert the normal to a matrix3 value for the Point.
-eric
[/left]
[/left]
Perfect Pixel Monkey. Wasn鈥檛 aware of the dir property. That will be very useful in this project.
So鈥?back to my original issue with testing vertices for colour change鈥?br>
I鈥檓 wondering do i have to use RenderTexturemap, then match uv co-ords to texture co-ords to test? Or is there a simpler way鈥? Anyone?
You can look up Barycentric Coordinates here and in the Maxscript Help.
-Eric
[/left]