ropeypopey opened this issue on Aug 31, 2006 · 36 posts
ropeypopey posted Sat, 02 September 2006 at 4:25 PM
Not too sure about the "swoop" bit, but here what I got.
##########
s = Surface(Marble1(GRAY8, Blend(.5*ORANGE, GRAY8, .5), 2.2, gc=1),1,WHITE, 0.6, 0.02)
Radius = 0.16 # For standard cylinder prop
TwoPi = 2.0 * pi # Need this a lot
Angle = TwoPi * U # Turn U into an angle
Disp = 0
def Torus(Start, End):
Diam = End - Start
k = (V - Start) % Diam
k = Max(k * (Diam - k), 0) # avoid negative numbers ;-)
DispTorus = Sqrt(k)
return DispTorus
Trig4 = Max ( Abs(Cos(Angle)), Abs(Sin(Angle)) )
Size4 = 1.1 # Relative to the radius
Disp4 = Radius * (Size4/Trig4 - 1) # 4-sided surface
Eighth = TwoPi / 8.0
Trig8 = Max (Abs(Cos((Angle+Eighth)%TwoPi)), Abs(Sin((Angle+Eighth)%TwoPi)))
Trig8 = Max (Trig4, Trig8) # includes the 45 degree angles
Size8 = 0.8 # Relative to the radius
Disp8 = Radius * (Size8/Trig8 - 1) # 8-sided surface
Disp = Blender (Disp4, Disp8, InRange(V, 0.15, 0.85))
T_Start = 0.15
T_End = 0.22
T_Disp = Torus (T_Start, T_End)
Disp = Blender ( Disp, T_Disp, InRange(V, T_Start, T_End))
T_Start = 0.78
T_End = 0.85
T_Disp = Torus (T_Start, T_End)
Disp = Blender ( Disp, T_Disp, InRange(V, T_Start, T_End))
s.Displacement = 30 * Disp * (Abs(N(0,1,0)) <= .01) # no caps
As for the smooth blending between the square and circular parts, it's probably just a matter of putting in the right bias (still learning)
Rô
My favourite question is "Why?", my second favourite is "Why not?"