Forum: Poser - OFFICIAL


Subject: Node Based Human Irises

bagginsbill opened this issue on May 17, 2007 · 67 posts


bagginsbill posted Fri, 18 May 2007 at 8:59 AM

A "function" node, a node where you could type in a mathematical formula, does not exist. This is why I created matmatic in the first place.

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.

Bagginsbill's handy function to make conditional evaluations look more readable

def IF(test, a, b):
 return Blend(b, a, test)

A limited arcsin function that returns between 0 and pi/2

ONLY WORKS for x = 0..1

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))

Bagginbill's extrapolation to get theta -pi < theta < pi

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))

Bagginsbill's class to convert to polar coordinates because

we can share the sqrt part for r and 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)