Addded fncs :
- radtodeg -> converts radians to degrees
- degtorad -> converts degrees to radians
- union -> perlin boolean op -> ((a+b) - (a*b))
- diff -> perlin boolean op -> ((a) - (a*b))
Added 3-args fncs :
- clamp -> constrains x to lie between a and b ..(x,a,b)
- lerp -> interpolates linearly x between a and b .. (a,b,x)
- exerp -> exponential interpolation
- logerp -> logarithmic interpolation
- sstep -> smoothstep function .. (a,b,x)
- pulse -> step(edge0, x) - step(edge1, x);
- pulset -> pulse (edge, period, mod(x,period));
Added constants :
- PI -> π -> 3.1459...
- E -> euler -> 2.7182...
- GR -> goldenratio -> 1.6180...
Added globals :
all shading float/int globals are available.
Name convention is : SG(shading globals) + uppercase variable name, ie:
SGU -> float u .. U surface parameter
SGDUDX -> float dudx .. U derivative wrt screen X-axis
SGSC -> uint8_t sc .. type of shading context
Added : README file
Now, to test for example constants and new fncs .. we know that Pi is the ratio of a circle's circumference to its diameter .. so if you input radtodeg(PI) .. and assign the shader to a cube .. go to the Pixel tab of your Arnold IPR view .. and put the mouse cursor over the rendered cube .. you should see 180 under Lum (remember that what you see in the IPR is not what you source from the pixel which is linear raw.. so values are not altered).
With globals instead we can re-write the previous exps without having to leave mathParser .. for example following :
(floor(SGU*12-SGV*12) + floor(SGU*12+SGV*12)) %2
does the same as above .. where SGU and SGV are the previous state_float->U and state_float->V connected to x and y slots.
Eventually a bit more involved example where we design some antialised circles.