Forum: Poser - OFFICIAL


Subject: Matmatic - Displacement Problem

ropeypopey opened this issue on Aug 31, 2006 · 36 posts


ropeypopey posted Sat, 02 September 2006 at 4:25 PM

> Quote - In a church I saw pillars that are square at the ends, convert to a round torus with a swoop, then become 8-sided for the long middle part.

Not too sure about the "swoop" bit, but here what I got.

Church coloumns

##########
s = Surface(Marble1(GRAY8, Blend(.5*ORANGE, GRAY8, .5), 2.2, gc=1),1,WHITE, 0.6, 0.02)

General Stuff

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

Torus Routine

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

Four-Sided Parts

Trig4 = Max ( Abs(Cos(Angle)), Abs(Sin(Angle)) )
Size4 = 1.1                            # Relative to the radius
Disp4 = Radius * (Size4/Trig4 - 1)    # 4-sided surface   

Eight-Sided Parts

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

Add Bottom Torus

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

Add Top Torus

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)

My favourite question is "Why?", my second favourite is "Why not?"