POV-Ray : Newsgroups : povray.binaries.images : Pascal Blocks 3D (75kb jpeg) Server Time
14 Nov 2024 00:17:21 EST (-0500)
  Pascal Blocks 3D (75kb jpeg) (Message 1 to 1 of 1)  
From: Samuel Benge
Subject: Pascal Blocks 3D (75kb jpeg)
Date: 18 Sep 2004 12:16:48
Message: <414C5F23.8000503@hotmail.com>
Okay, here's another one. This time, I simply adapted the code to work 
in three dimensions instead of two. I did not even attempt to center the 
pyramid in relation to itself.

Amazingly (at least to me) this render took only 3 minutes, 35 seconds! 
It uses one 8x8 area_light and 'goodish' radiosity settings. About three 
seconds and it was parsed.

Here's the basic code, for those interested. It's not super-efficient, 
it simply works :)

//begin the code!
#declare obj=sphere{0,.5}
union{
  #local Y=1;
  #while(Y<17)
   #local Z=0;
   #while(Z<Y)
    #local X=0;
    #while(X<Y)
     #local t1=
      inside(obj,<X-1,Y-1,Z-1>);
     #local t2=
      inside(obj,<X-1,Y-1,Z>);
     #local t3=
      inside(obj,<X,Y-1,Z-1>);
     #local t4=
      inside(obj,<X,Y-1,Z>);
     #local T=t1+t2+t3+t4;
     #local obj=
     union{
      object{obj}
      #if(T=1|T=3)
       box{-.5,.5 translate<X,Y,Z>}
       #else sphere{0,.1}
      #end
     }
     #local X=X+1;
    #end
    #local Z=Z+1;
   #end
   #local Y=Y+1;
  #end
}
object{obj pigment{rgb .7} rotate z*180+y*55 translate<10,10.5,0>}
//end code

Q's & C's, welcome as usual~

-Sam


Post a reply to this message


Attachments:
Download 'pascal_blocks_3d.jpg' (75 KB)

Preview of image 'pascal_blocks_3d.jpg'
pascal_blocks_3d.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.