POV-Ray : Newsgroups : povray.newusers : Faceted sphere? : Re: Faceted sphere? Server Time
30 Jul 2024 02:13:56 EDT (-0400)
  Re: Faceted sphere?  
From: Shay
Date: 10 Mar 2005 11:26:07
Message: <4230751f$1@news.povray.org>
X-Caliber wrote:
> 
> ....and quadrupling both defines leads to amazingly long
> render times.
> 
> (2 minutes becomes 13 hours)

13 hours for four times as many? Try Forty times as many.
Expect a few minutes to parse this, but you'll be shocked at the render 
speed. No camera or lights here, so don't forget to add your own.


// each square looks like v0 v1
//                        v2 v3

#local dA = 240; // latitiude
#local dO = 480; // longitude

mesh {
   #local cA = 0; #while ( cA < dA )
     #local cO = 0; #while ( cO < dO )
       // rotate corners into place
       #local v0 = vrotate(<0,1,0>, <180*(cA+0)/dA,360*(cO+0)/dO,0>);
       #local v1 = vrotate(<0,1,0>, <180*(cA+0)/dA,360*(cO+1)/dO,0>);
       #local v2 = vrotate(<0,1,0>, <180*(cA+1)/dA,360*(cO+0)/dO,0>);
       #local v3 = vrotate(<0,1,0>, <180*(cA+1)/dA,360*(cO+1)/dO,0>);
       // select a color
       #if ( mod ( cO+cA, 2 ) = 1 )
     	  #local myTex = texture { pigment { rgb <1,0,0> } }
       #else
     	  #local myTex = texture { pigment { rgb <1,1,1> } }
       #end
       // fill in the boxes with triangles
       #if ( cA > 0 ) // not at the top
         triangle { v0, v1, v3 texture { myTex } }
       #end
       #if ( cA < dA-1 ) // not at the bottom
         triangle { v0, v3, v2 texture { myTex } }
       #end
     #local cO = cO + 1; #end
   #local cA = cA + 1; #end
}

// -Shay


Post a reply to this message

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