bagginsbill opened this issue on May 17, 2007 · 67 posts
bagginsbill posted Fri, 18 May 2007 at 8:59 AM
Matmatic takes your formulas and implements them in nodes.
So for example when I type Bump = .03 * Bias(100 * (U + V) % pi, .7), it figures out that you can do that with 5 nodes and generates the shader you see in the image above.
So I don't really care any more that there is no formula node.
And I already have an extremely accurate and cheap conversion to polar coordinates. It is this:
So I don't really need any reference material for this purpose - the issue has already been resolved and tested extensively. With the above code included in a script, the U and V coordinates are now polar instead of rectangular. The rest of your script can then deal with U and V as usual and whatever you've described will be spun around a circle.
def IF(test, a, b):
return Blend(b, a, test)
def limitedArcSin(x):
a0=1.5707288
a1=-0.2121144
a2=0.0742610
a3=-0.0187293
x2 = x * x
x3 = x2 * x
return (pi/2 - sqrt(1 - x) * (a0 + a1x + a2x2+ a3*x3))
def getTheta(x, y, r = None):
if r is None:
r = sqrt(x * x + y * y)
sinval = Abs(y)/r
theta = limitedArcSin(sinval)
return IF(x <= 0,
IF(y <= 0, -pi+theta, pi-theta),
IF(y <= 0, -theta, theta))
class PolarCoord:
def init(self, x, y):
self.x = x
self.y = y
self.r = sqrt(x * x + y * y)
self.theta = getTheta(x, y, self.r)
pc = PolarCoord(2 * U - 1, 2 * V - 1)
U = pc.theta
V = pc.r
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)