displacement KTtreeD ( float separeat1=0.5,separeat2=0.85; float amp1=0.5,amp2=0.3,amp3=0.05; float scale=40,mag=0.01; float octaves=8,lambda=2; point N1=point(-0.5,-0.5,0),N2=point(0,1,0),N3=point(-0.2,0.5,0); point Center=point(0,0,0) ) { float amp,littlemag; float i,value,freq; float tt; point PP,PT,Pmove; PP=transform("object",P); PT=PP*scale; tt=t; amp=smoothstep(0,separeat1,tt)*amp1; Pmove=N1-Center; Pmove=normalize(Pmove); /*printf ("Pmove = %p\n",Pmove); *printf ("Center = %p\n",Center); *printf ("N1 = %p\n",N1);*/ P+=amp*Pmove; if (tt>separeat1) { amp=smoothstep(separeat1,separeat2,tt)*amp2; Pmove=N2-Center; Pmove=normalize(Pmove); P+=amp*Pmove; } if (tt>separeat2) { amp=smoothstep(separeat2,1,tt)*amp3; Pmove=N3-Center; Pmove=normalize(Pmove); P+=amp*Pmove; } N=calculatenormal(P); value=0; freq=1; for (i=1;i