POV-Ray : Newsgroups : povray.binaries.images : Hopes dashed again : Hopes dashed again Server Time
18 Aug 2024 16:21:23 EDT (-0400)
  Hopes dashed again  
From: Bryan Valencia
Date: 3 Apr 2001 14:53:06
Message: <3ACA1CC1.A576CCF7@209software.com>
[Image]

This is my lego planet.  It's made entirely of clear 4x2 Lego blocks.
It was to have a diameter of 500 units, but anything much over 20 and it
crashes my system.

Here's the source.

// Persistence of Vision Ray Tracer Scene Description File
// File: ClearLegoFortress.pov
// Vers: 3.1
// Desc: Clear Lego Planets
// Date: 3/28/2K1
// Auth: Bryan Valencia
//

#version unofficial MegaPov 0.6;

#include "colors.inc"

global_settings{assumed_gamma 1.0}


#include "Lego.inc"



#declare D=20; //units, not blocks

#declare A=-D;
#while (A<D)

    #declare B=-D;
    #while (B<D)
        #declare C=-D;
        #while (C<D)
            #if (sqrt((A*A)+(B*B)+(C*C))<D) object {ClearLego
translate<A,B,C>} #end
            #declare C=C+BZ;

        #end
        #declare B=B+LH;
    #end
    #declare A=A+BX;
#end


// ----------------------------------------
camera{
  location  <-D, D, -D*3>
  look_at   <0,0,0>
}


light_source{ <-90, 30, 30> color rgb<1,1,1> }

// ----------------------------------------

//This is Lego.inc
#declare LH=1.5;
#declare CT=LH+.25;
#declare Rounding=0.04;
#declare BX=2;
#declare BZ=4;

#declare Z=Rounding;
#declare FH=LH-Rounding;
#declare FX=BX-Rounding;
#declare FZ=BZ-Rounding;


#declare SubtractFrame=merge{
            cylinder{<0,0,0><BX,0,0>,Rounding}
            cylinder{<0,LH,0><BX,LH,0>,Rounding}
            cylinder{<0,0,BZ><BX,0,BZ>,Rounding}
            cylinder{<0,LH,BZ><BX,LH,BZ>,Rounding}
            cylinder{<0,0,BZ><0,LH,BZ>,Rounding}
            cylinder{<BX,0,BZ><BX,LH,BZ>,Rounding}
            cylinder{<0,0,0><0,LH,0>,Rounding}
            cylinder{<BX,0,0><BX,LH,0>,Rounding}
            cylinder{<0,0,0><0,0,BZ>,Rounding}
            cylinder{<BX,0,0><BX,0,BZ>,Rounding}
            cylinder{<0,LH,0><0,LH,BZ>,Rounding}
            cylinder{<BX,LH,0><BX,LH,BZ>,Rounding}
            sphere{<0,0,0>,Rounding}//bottom4
            sphere{<BX,0,0>,Rounding}
            sphere{<BX,0,BZ>,Rounding}
            sphere{<0,0,BZ>,Rounding}
            sphere{<0,LH,0>,Rounding}//top
            sphere{<BX,LH,0>,Rounding}
            sphere{<BX,LH,BZ>,Rounding}
            sphere{<0,LH,BZ>,Rounding}
}



#declare AddFrame=merge{
            cylinder{<Z,Z,Z><FX,Z,Z>,Rounding}
            cylinder{<Z,FH,Z><FX,FH,Z>,Rounding}
            cylinder{<Z,Z,FZ><FX,Z,FZ>,Rounding}
            cylinder{<Z,FH,FZ><FX,FH,FZ>,Rounding}
            cylinder{<Z,Z,FZ><Z,FH,FZ>,Rounding}
            cylinder{<FX,Z,FZ><FX,FH,FZ>,Rounding}
            cylinder{<Z,Z,Z><Z,FH,Z>,Rounding}
            cylinder{<FX,Z,Z><FX,FH,Z>,Rounding}
            cylinder{<Z,Z,Z><Z,Z,FZ>,Rounding}
            cylinder{<FX,Z,Z><FX,Z,FZ>,Rounding}
            cylinder{<Z,FH,Z><Z,FH,FZ>,Rounding}
            cylinder{<FX,FH,Z><FX,FH,FZ>,Rounding}
            sphere{<Z,Z,Z>,Rounding}//bottom4
            sphere{<FX,Z,Z>,Rounding}
            sphere{<FX,Z,FZ>,Rounding}
            sphere{<Z,Z,FZ>,Rounding}
            sphere{<Z,FH,Z>,Rounding}//top
            sphere{<FX,FH,Z>,Rounding}
            sphere{<FX,FH,FZ>,Rounding}
            sphere{<Z,FH,FZ>,Rounding}
}

#declare INR1=.4;

#declare InCyl=union{
    difference{
        cylinder{<0,0,0>,<0,LH-Rounding,0>,INR1}
        cylinder{<0,-Rounding,0>,<0,LH-Rounding,0>,INR1-Rounding}

    }
    torus{INR1-Rounding, Rounding}
}

#declare Lego=union{
    difference{
        box{<0,0,0><BX,1.5,BZ>}
        union{
            object{SubtractFrame}

box{<Rounding,-Rounding,Rounding><BX-Rounding,LH-.1,BZ-Rounding>}
        }
    }
    object{InCyl translate<BX/2, 0, BZ/2>}
    object{InCyl translate<BX/2, 0, BZ/2+1>}
    object{InCyl translate<BX/2, 0, BZ/2-1>}
    object{AddFrame}
    cylinder{<.5,LH,.5>  <.5,CT,.5>,.2}
    cylinder{<1.5,LH,.5> <1.5,CT,.5>,.2}
    cylinder{<.5,LH,1.5>  <.5,CT,1.5>,.2}
    cylinder{<1.5,LH,1.5> <1.5,CT,1.5>,.2}
    cylinder{<.5,LH,2.5>  <.5,CT,2.5>,.2}
    cylinder{<1.5,LH,2.5> <1.5,CT,2.5>,.2}
    cylinder{<.5,LH,3.5>  <.5,CT,3.5>,.2}
    cylinder{<1.5,LH,3.5> <1.5,CT,3.5>,.2}
}


#declare FastClear = texture{
        pigment{rgbf<1,1,1,.8>}
        finish{reflection .1 phong .2}
}

#declare LegoIOR=1.88;

#declare ClearLego=object{Lego texture{FastClear} interior{ ior LegoIOR
}}


Post a reply to this message

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