POV-Ray : Newsgroups : povray.binaries.images : Rounded Prisms Server Time
1 Jun 2024 15:01:08 EDT (-0400)
  Rounded Prisms (Message 11 to 20 of 26)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 6 Messages >>>
From: PM 2Ring
Subject: Re: Rounded Prisms
Date: 24 Nov 2005 20:50:00
Message: <web.43866db57ed7ae6cad93754b0@news.povray.org>
repiv <me### [at] privatenet> wrote:
> Jellby wrote:
> > Would it be possible to have rounded inner corners as well?
> >
> > I mean, where the polygon is concave, you see a "seam" in the rounded edge,
> > I guess you need a torus here.
> I wrote a macro for this once, with variable radii for each vertex. Never
> quite finished it.
>
> Attached is a demo render, no HDRI, radiosity or checkered floor though, I
> apologize.


Beautiful, repiv. Are you using a torus?


Post a reply to this message

From: PM 2Ring
Subject: Re: Rounded Prisms
Date: 25 Nov 2005 04:50:01
Message: <web.4386daf17ed7ae6c2eef1b3b0@news.povray.org>
"Joanne Simpson" <cor### [at] onewhiteravencom> wrote:
> > Look fantastic - could make some great abstract images using these!! Be
> > great to post the source.  Great work!  Adrian

Thanks, Adrian.

>
> yes, please post the source - I am looking for some nice tesselations /
> Penrose tilings for a garden pavement.
> Joanne

Hi Joanne,

Here's a scene that uses two different Penrose tilings. I've posted an image
of this scene before, but I didn't post the source. I've been meaning to
tidy it up & add more comments, but... :) One day, I'd like to do more with
this scene, but I think I need to buy more memory first.

As for the scene, as well as using rounded regular polygonal prisms, it has
a nice macro for making rounded isoceles triangles. It also illustrates one
way of getting multicoloured objects using the object pattern. Oh, and it
also has a dodecahedron (or two) hiding inside. :)

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

// Persistence of Vision Ray Tracer Scene Description File
// File: Penrose.pov
// Vers: 3.6
// Desc: Penrose tiles. Penrose triangle macros modified from John
VanSickle's Boxer
// Date: 2005.02.26
// Auth: PM 2Ring
//
// -F -A0.5 +AM2 +R1
// +A0.3 +AM2 +R2 -D
// +A0.05 +AM2 +R3 -D
// +A0.025 +AM2 +R2

//Set to 1 when rendering 3D pairs with StereoPOV
#declare Use_Stereo=0;

#if(Use_Stereo)
  #version unofficial stereopov 0.2;
#else
  #version 3.6;
#end

//Some rendering and scene element boolean parameters
#declare Radio = 0;
#declare Photons = 0;
#declare Area_Lights = 0;

//Element selection
#declare Do_Sky = 1;          //Clouds?
#declare Do_Skysphere = 1;    //Skysphere or background

#declare Do_Room = 1;
#declare Do_Walls = 1;
#declare Do_Base = 1;
#declare Do_Floor = 1;
#declare Do_Seats = 1;
#declare Do_Dodec = 0;        //Glass dodecahedron
#declare Do_Water = 1;

//Scene control
#declare View_Overhead = 0;
#declare Do_Rounded = 1;      //Tile: rounded edges & points
#declare Do_Reflect = 1;      //Tile & wall reflection
#declare Disperse = 0;        //Glass dispersion sample number. 0 for no
dispersion

//Other parameters
#declare Rdepth = 4;          //Recursion depth for tiles   6

#declare SkyRad = 1E3;
#declare Rad = 60;

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

global_settings {
  assumed_gamma 1 // 1.5
  max_trace_level 20 //45

#if(Photons)
  photons {
    count 150000
    autostop 0
  }
#end

#if(Radio)
  radiosity {
    pretrace_end .08
    //count 60

    //nearest_count 6
    //error_bound 1.5     //default 1.8    0.4
    //recursion_limit 3

    gray_threshold .1 //.125
    low_error_factor 0.8
    brightness 1

    adc_bailout 0.01/2
    always_sample off
  }

  //ambient_light 0.2
#end
}

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

camera{
#if(View_Overhead)
  orthographic
#end

#if(1)
  location  vnormalize(<.65, 1.80, -5.0>) * Rad //* 1.125
  look_at   <-.5, 5.75, 0>
#else
  location  vnormalize(<0, 5, 0>) * Rad * .99 * 1.3 * 1.55
  //look_at   0
  look_at   0*6.5*y - 20.25*z
#end

  right     x*image_width/image_height up y
  angle 45

  #if(Use_Stereo)
   window_distance Rad * 1.75 * .8
    cross_eyed
 #end
}

light_source{
  vnormalize(<-1.5, 15, -20>) * .15 * SkyRad // SkyRad
  rgb 1.25

  #if(Area_Lights)
    #declare AL = 6;
    #declare ASize = 120;
    area_light x*ASize, z*ASize, AL, AL
    adaptive 1
    jitter
    circular
    orient
  #end

  photons {
    reflection on
    refraction on
    //#if(Area_Lights) area_light #end
  }
}

// ---Textures-------------------------------------
#declare SkyBlue = rgb<.035, .27, .67>+.125;    //For water & sky in 8-bit:
9 69 171

//Make a color_map from a0 to a1
#macro CMRange(a0, a1)color_map{[0 a0][1 a1]}#end

//Make a color_map from Black to a
#macro CMFull(a)CMRange(rgb 0, a)#end

#declare CM_Clouds2 =
color_map{
    [0.0   rgb 1 filter .05]
    [0.05  rgb 0.85 filter .15]
    [0.15  rgbf 0.75 filter .25]
    [0.525 rgbf 1]
    //[0.525 SkyBlue]
}

#declare CM_Stone =
color_map {
    [0.00 rgb 1]
    [0.10 rgb 0.75]
    //[0.30 SkyBlue ]
    [0.30 rgb<.5, .2, .2> ]
}

#declare T_Clouds =
texture{
  pigment{
    bozo
    color_map{CM_Clouds2}

    warp{
      turbulence .25
      octaves 6
      omega 0.7
      lambda 2.25
    }
  }
  //finish{ambient 1.325 diffuse 0.2}
  finish{ambient .9 diffuse 0.1}
}

#declare FTile = finish{
  phong .25 phong_size 160
  specular .5 roughness 1.5e-4

  #if(Do_Reflect)
    diffuse 0.70 ambient 0.05*0
    reflection {
      0.15  // .175
      //0.75 metallic
    }
    //conserve_energy
  #else
    diffuse 0.875 ambient 0.1
  #end

  //metallic
  //brilliance 2
}

#declare PWall=pigment{
    marble
    turbulence .65
    color_map{[0 rgb .45][0.1 rgb .75][1 rgb 1]}
    //rgb .9
    scale 1.875
}

#declare FWall=finish{
  specular .5 roughness 1e-3
  phong .25  phong_size 200
  ambient 0.1 diffuse .75
#if(Do_Reflect)
  ambient 0.03*0 diffuse .65
  reflection .15 //
#end
}

#declare TWall0=texture{
  pigment{PWall}
  finish{FWall}
  //normal{granite .1  scale 3e-4}
}

#declare TWall=texture{
  pigment{
    radial
    pigment_map{
      #declare I=0;
      #while(I<1)
        [I PWall rotate I*360*y translate I*z*Rad]
        [I+.1 PWall rotate I*360*y translate I*z*Rad]
        #declare I=I+.1;
      #end
    }
  }
  finish{FWall}
  //normal{granite .1  scale 3e-4}
}

#declare TGrout=texture{
  pigment{
    //granite scale 2e-5
    //color_map{[0.1 rgb .5][0.5 rgb 1]}
    //rgb .9
    rgb <.9 .95 1> * .9
  }
  finish{
    ambient 0.05
    //ambient 0.2
    diffuse .8
  }
  //normal{granite .1  scale 3e-4}
}

#declare TSeat =
texture{
  pigment{
    PWall rotate y*90
    //crackle
    //color_map {CM_Clouds2}
    //color_map {CM_Stone}
    color_map{[0 rgb .45][0.1 rgb .75][1 rgb 1]}
  }
  finish{
    ambient .05 diffuse .65
    specular .5 roughness 1e-3
    reflection .15
  }
}

#declare TWater=texture{
  pigment{
    //rgb <.8 .95 1> * .85
    //SkyBlue * .85
    rgb <.1 .6 .5>
  }
  finish{
    ambient 0.025 diffuse .15 reflection {.05, .9}
    conserve_energy
    metallic
  }
  normal{wrinkles .45 turbulence .055 scale 52 bump_size .105 }
}

#declare TGlass = texture
{
  finish
  {
    ambient 0
    diffuse 0.15 //.2
    reflection {0.05, 1 fresnel}

    specular .75
    roughness 0.0001
    //brilliance 1.5
    conserve_energy
  }
  pigment { color rgbf <0.985, .9975, .990, 1> }
}

#declare TTile=texture{
  pigment{
    marble turbulence .65
    color_map{[0 rgb .45][0.1 rgb .75][1 rgb 1]}

    rotate x*90 scale 3
  }
  finish{FTile}
  //normal{granite .15 scale 1e-4}
}

//Tile textures
#declare Pig3=rgb 1;             //white
//#declare Pig3=rgb <1 .65 .65>;             //red
#declare Pig2=rgb <1 .85 .45>;         //yellow
#declare Pig1=rgb <.45 .675 1>;        //blue

//Boost colour to compensate for averaging process, where it gets averaged
with Pig1
#macro Boost(A,B) 2*A-B #end
#declare Pig2=Boost(Pig2, Pig3);         //yellow
#declare Pig1=Boost(Pig1, Pig3);        //blue

//Tile textures
#declare Tex3=
//texture{TTile}
texture{
  pigment{Pig3}
  //finish{FTile}
}

#declare Tex2=
//texture{TTile}
texture{
  pigment{Pig2}
  //finish{FTile}
}

#declare Tex1=
//texture{TTile}
texture{
  pigment{Pig1}
  //finish{FTile}
}

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

#declare Top = .30;     //Tile top height
#declare Mid = Top / 2; //Tile Middle height
#declare Sep = ((Do_Rounded)?Mid:0) + Mid * .07*2;      //Tile separation
...15

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

//Convert 2D vector to 3D, at height Mid
#macro XYZ(Q)<Q.u,Mid,Q.v>#end

//Convert 3D to 2D
#macro XZ(Q) <Q.x, Q.z> #end

//Make a simple triangle tile
#macro Tri0(A2,B2,C2) prism{linear_spline -1e-3,Top+1e-3,4, A2,B2,C2,A2}#end

//Make an isoceles triangle tile, with room for mortar
#macro Tri(A2,B2,C2)
    //Convert points to 3D
    #local A3 = XYZ(A2);
    #local B3 = XYZ(B2);
    #local C3 = XYZ(C2);

    //Find centre = intersections of angle bisectors
    #local M3 = (B3 + C3)/2;      //Midpoint of base
    #local A = vlength(C2-B2)/2;  //Half-Length of base
    #local S = vlength(A2-B2);    //Length of sloping side
    //#local SS = vlength(A2-C2);    //Length of other sloping side
    //#if(S!=SS)
    //  #debug concat("nApex Wrong! AB= ", str(S,0,0), " AC= ", str(SS,0,0),
" BC= ", str(2*A,0,0))
    //#end

    #local Cen = (A*A3 + S*M3)/(A + S);               //Interpolate from M
to A to find centre
    #local Sc = 1 - Sep * (A+S)/(A*sqrt(S*S-A*A));    //Scale factor to get
mortar+roundness width

#if(Do_Rounded)
  union{
    prism{
      linear_spline 0,Top,4
      A2,B2,C2,A2
    }
    union{
        cylinder{A3,B3,Mid}
        cylinder{B3,C3,Mid}
        cylinder{C3,A3,Mid}
        sphere{A3, Mid}
        sphere{B3, Mid}
        sphere{C3, Mid}
        //pigment{rgb 1}finish{phong .5 phong_size 200  reflection 0}
    }
#else
  prism{
    linear_spline 0,Top,4
    A2,B2,C2,A2
#end

    //Scale to create border Sep units wide
    translate -Cen
    scale <Sc, 1, Sc>
    translate Cen
  }
#end

#debug "nIgnore following warning, this union intentionally emptyn"
#declare Null = union{}
#debug "Ignore previous warning, this union intentionally emptyn"

#declare SetT = Null;
#declare SetP = array[2]{Null, Null};

#macro AddTri(A,B,C) #declare SetT = union{object{SetT} Tri(A,B,C)} #end
#macro AddTri0(A,B,C,P) #declare SetP[P] = union{object{SetP[P]}
Tri0(A,B,C)} #end

// ---Penrose triangle macros-------------------------------------

//Interpolate from A to B
#macro inter(A,B,r) (A+(B-A)*r) #end

#declare Phi=(sqrt(5)+1)/2;            //The Golden ratio
#declare phi=Phi-1;

#macro PutSlim(A,B,C,P)
  AddTri(A,B,C)

  #local E = inter(A,B,.5);
  #local F = inter(A,C,phi);
  #local G = inter(B,C,Phi/2);

  //AddTri0(C,F,G)       //colour 3

  AddTri0(A,E,F,P)
  AddTri0(B,E,F,!P)
  AddTri0(B,G,F,!P)
#end

#macro PutWide(A,B,C,P)
  AddTri(A,B,C)

  #local E = inter(B,A,Phi/2);
  #local F = inter(B,C,phi);

  //AddTri0(A,F,E)   //colour 3
  //AddTri0(A,F,C)   //colour 3

  AddTri0(B,E,F,!P)
#end

#macro Slim(A,B,C,D,P)
  #if(D=0)
    PutSlim(A,B,C,P)
  #else
    #local E = inter(A,B,phi);
    #local F = inter(C,A,phi);

    Wide(F,E,A,D-1,P)
    Slim(C,E,F,D-1,P)
    Slim(C,E,B,D-1,P)
  #end
#end

#macro Wide(A,B,C,D,P)
  #if(D=0)
    PutWide(A,B,C,P)
  #else
    #local E = inter(C,B,phi);

    Wide(E,A,B,D-1,1-P)
    Slim(C,A,E,D-1,1-P)
  #end
#end

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

#declare Ang = pi/5;
#declare Ang0 = radians(-117);
#declare Ang1 = radians(-81);

#if(Do_Room)
#if(Do_Floor)
//Fill Sets with triangles & pentagons
Slim(<0,0>, <cos(Ang0), sin(Ang0)>*Rad, <cos(Ang1), sin(Ang1)>*Rad, Rdepth,
0)

#declare PentaPig=
pigment{
  average
  pigment_map{
    [1 object{SetP[0] Pig3, Pig1}]
    [1 object{SetP[1] Pig3, Pig2}]
  }
}

#declare Wedge=
object{
  SetT
  pigment{PentaPig}
  finish{FTile}
}

#declare Floor =
union{
#declare I=0;
#while(I<5)
  object {Wedge rotate y*72*I}
  object {Wedge matrix <0,0,-1, 0,1,0, -1,0,0, 0,0,0> rotate y*72*I}
  #declare I=I+1;
#end
  rotate (0*90-9)*y

#if(1)
 photons {
   //target
   refraction off
   reflection on
   collect on
  }
#end
}
#end

//Decagon base for tiles
#if(Do_Base)
#declare Base =
prism{linear_spline -Top*2, Mid, 11,
#declare I=0;
#while(I<=10)
  <cos(Ang*I), sin(Ang*I)>* (Rad*1.1 + Sep)

  #declare I=I+1;
#end
  //no_shadow

  texture{TGrout}
}
#end

//Decagon room
#if(Do_Walls)
#declare Walls =
prism{linear_spline Mid, Rad/18, 22,
#declare I=0;
#while(I<=10)
  <cos(Ang*I), sin(Ang*I)>* (Rad + Sep)

  #declare I=I+1;
#end

#declare I=0;
#while(I<=10)
  <cos(Ang*I), sin(Ang*I)>* (Rad*1.1 + Sep)

  #declare I=I+1;
#end

  texture{TWall}
}
#end

#declare DR = (phi + 1)/sqrt(phi+3);
#declare DA = DR / (phi * phi * 2);
#declare DScale = Rad *pow(phi,4) / 1.258408572;
//#declare SR = .05;
#declare DHi = (Top + 1e-4) * y;

#if(Do_Dodec)
//Simplified from "shapes2.inc"
#declare Dodecahedron =
intersection
{
#declare Ax = degrees(atan2(1,2));
#declare I=0;
#while(I<5)
  plane {-z, 1 rotate <-Ax,    -72*I, 0>}
  plane {-z, 1 rotate < Ax, -36-72*I, 0>}
  #declare I=I+1;
#end

  plane { y, 1}
  plane {-y, 1}

  bounded_by {sphere {0, 1.2585}}
}

#declare Dodec =
object{
  Dodecahedron

  //pigment{rgb 1} finish{ambient 0 diffuse .1 specular .3 reflection .9}
  texture {TGlass}
  interior{
    //ior 1.75
    ior 1.1

    #if(!Photons) caustics 1 #end
    #if(1)
      #if(Disperse>0)
        dispersion 1.012
        dispersion_samples Disperse
      #end

      fade_distance Rad * 2//* phi
      fade_power 2 // 1001
      fade_color rgb <0, 0, .25>
    #end
  }

  rotate 18*y
  translate y
  scale DScale
  translate DHi

#if(1)
 photons {
   target
   refraction on
   reflection on
   collect off
  }
#end
}
#end

//Convert 2D to 3D, height H
#macro V3D(A, H)<A.u,H,A.v>#end

//Rounded Prism
#macro RPrism(Sides, Rad0, SH, SR)
  #local Ang = 2*pi/Sides;
  #local Rad = Rad0 - SR;
  #local Vtx = array[Sides+1];    //To store polygon vertices
  //#local Panel = box{<0,0,-SR>, <2*Rad*sin(Ang/2), SH-SR, SR>}   //Side
panel
  #local Panel = box{0, <2*Rad*sin(Ang/2), SH-SR, -SR>}   //Side panel - New
improved!

  union{
    prism{
      linear_spline 0, SH, Sides+1,
      #local I=0;
      #while(I<=Sides)
        #local Vtx[I] = <cos(Ang*I), sin(Ang*I)>*Rad;
        Vtx[I]
        #local I=I+1;
      #end
    }

    #local SH = SH - SR;
    #local I=0;
    #while(I<Sides)
      #local II = mod(I+1,Sides);
      #local A0 = V3D(Vtx[I],0);
      #local A1 = V3D(Vtx[I],SH);

      sphere{A1, SR}
      cylinder{0, SH*y, SR translate A0}
      cylinder{A1, V3D(Vtx[II],SH), SR}
      object{Panel rotate -y*(90 + 360*(I+.5)/Sides) translate A0}

      #local I=I+1;
    #end

    #if(mod(Sides,2)=1) rotate -y*90/Sides #end
  }
#end

#declare SRad = Rad*pow(phi,5);
#declare Seat =
object{
  RPrism(10, SRad, SRad*phi, SRad*.1)

  texture{TSeat}
  //pigment{rgb 1}
  //finish{specular .5 roughness 1e-3 reflection .25 diffuse .8}

  translate Top*y
}

// ---Scene-------------------------------------

//Room & contents
union{
  #if(Do_Base) object{Base} #end
  #if(Do_Floor) object{Floor} #end
  #if(Do_Walls)
    //Footing
    object{Walls}
    #declare I=0;
    #while(I<10)
      //Columns
      cylinder{0, 8*y, .015*Rad translate <0, Rad/18.01, Rad> rotate
360*y*I/10 texture{TWall0}}
      cylinder{0, 8*y, .015*Rad translate <0, Rad/18.01,
Rad*1.1*sqrt(4*phi+7)*phi/2> rotate 360*y*(I+.5)/10 texture{TWall0}}
      #declare I=I+1;
    #end
    //Handrail
    object{Walls scale<1, 2*phi-1, 1> texture{TWall} translate
y*(8+Rad/18.02)}
  #end

  #if(Do_Dodec)
    object{Dodec rotate 0*180*y}
  #end

  #if(Do_Seats)
    #declare SRad = DR*DScale/DA;
    #if(0)
    object{
      RPrism(10, SRad, SRad*phi, SRad*.2)
      texture{TSeat}
      //texture{TTile}

      translate Top*y
    }
    #end

    #declare I=1;
    #while(I<5)
      object{Seat //pigment{rgb I/5}
        translate Rad*x*phi
        rotate y*72 * (I+1)
      }
      #declare I=I+1;
    #end
  #end

  rotate 18*y

#if(View_Overhead)
  scale .375 rotate -90*x
#end
}
#end

// ---Sky & Water-------------------------------------

//Water
#if(Do_Water)
object{
  sphere{-y*SkyRad*9.75, SkyRad*9.75}

  translate -y*5 //5
  texture{TWater scale .2}
}
#end

#declare Sky =
sphere{-y*SkyRad*9.750, SkyRad*10
  inverse
  no_shadow

  texture{
    T_Clouds
    rotate <18, 65, 0>
    scale  <1 .7 1> * SkyRad  * .325
  }
}

#if(Do_Sky)object{Sky}#end

#if(Do_Skysphere)
  sky_sphere{
    pigment{
      function{y}
      color_map{
        [0.0 SkyBlue]
        [0.19 rgb <0.0,0.1,0.8>*.675]
      }
      translate -y * .08
      scale 1.7
    }
  }
#else
  background{
    SkyBlue
    //rgb 0.25
  }
#end

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


Warning: the newsgroups's Web interface eats up backslashes, so you may want
to restore them in the #debug commands.


Post a reply to this message


Attachments:
Download 'rprismdi2s.jpg' (110 KB)

Preview of image 'rprismdi2s.jpg'
rprismdi2s.jpg


 

From: PM 2Ring
Subject: Re: Rounded Prisms
Date: 25 Nov 2005 05:55:01
Message: <web.4386eb2d7ed7ae6c2eef1b3b0@news.povray.org>
Oops! Wrong image! Oh well, I did intend to post that one, too, eventually.
:)

Here's Penrose Place.


Post a reply to this message


Attachments:
Download 'penrosets.jpg' (123 KB)

Preview of image 'penrosets.jpg'
penrosets.jpg


 

From: PM 2Ring
Subject: Re: Rounded Prisms
Date: 25 Nov 2005 06:30:00
Message: <web.4386f1417ed7ae6c2eef1b3b0@news.povray.org>
"PM 2Ring" <nomail@nomail> wrote:
> Oops! Wrong image! Oh well, I did intend to post that one, too, eventually.

And here is a much more rounded version to accompany the polyomino scene
file and a polyomino include file for it.

//penta.inc
/* POV include file. Polyominos */

#declare Polyomino1 = array[11][12]
{
  {0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 0},
  {0,  1,  1,  1,  1,  1,  2,  2,  2,  2,  3, 0},
  {0,  4,  4,  4,  5,  8,  2, 12, 12,  3,  3, 0},
  {0,  4,  4,  5,  5,  8,  8,  8, 12, 12,  3, 0},
  {0, 17, 17,  5,  6,  8,  6, 16, 11, 12,  3, 0},
  {0,  7, 17,  5,  6,  6,  6, 16, 11, 11, 11, 0},
  {0,  7, 17, 17, 10, 10,  9, 16, 16, 11, 13, 0},
  {0,  7,  7,  7, 10,  9,  9,  9, 16, 18, 13, 0},
  {0, 15, 15, 10, 10, 14,  9, 18, 18, 18, 13, 0},
  {0, 15, 15, 15, 14, 14, 14, 14, 18, 13, 13, 0},
  {0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 0},
}

#declare Polyomino2 = array[11][12]
{
  {0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 0},
  {0,  1,  1,  1,  1,  1,  2,  2,  2,  2,  3, 0},
  {0,  4,  4,  4,  5,  8,  2, 12, 12,  3,  3, 0},
  {0,  4,  4,  5,  5,  8,  8,  8, 12, 12,  3, 0},
  {0, 17, 17,  5, 16,  8, 11, 11, 14, 12,  3, 0},
  {0,  7, 17,  5, 16, 11, 11, 14, 14, 14, 14, 0},
  {0,  7, 17, 17, 16, 16, 11, 18, 18,  6,  6, 0},
  {0,  7,  7,  7,  9, 16, 10, 10, 18, 18,  6, 0},
  {0, 15, 15,  9,  9,  9, 10, 13, 18,  6,  6, 0},
  {0, 15, 15, 15,  9, 10, 10, 13, 13, 13, 13, 0},
  {0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 0},
}


//-------------------------End of file-------------------------

Sorry, people, I haven't gotten around to cleaning this scene up &
adding more comments, but if you have any questions, please ask here!

// Persistence of Vision Ray Tracer Scene Description File
// File: RPrism
// Vers: 3.5
// Desc: Rounded prisms: polyominoes
// Date: 2005-11-09
// Auth: PM 2Ring
//
// -d +A0.2 +AM2 +R4
// -F -A0.4 +AM2 +R1
// +A0.1 +AM2 +R3
// -d +A0.1 +AM2 +R3
// +W1600 +H1200 +A0.1 +AM2 +R3 -d
//

#include "colors.inc"
#include "stones.inc"

global_settings {
  assumed_gamma 1
  //max_trace_level 10
  //hf_gray_16
  //radiosity{always_sample 0}
}

#declare SkyBlue = rgb<.035, .27, .67>*.6;              //For water & sky
#declare SkyRad = 2E3;

camera {
  location <0, 12, -12.0> * 3.25
  //location 48 * y * 1.25

  right x*image_width/image_height up y
  direction z
  angle 30
  look_at -.05*y
}

light_source {<1, 4, -3> * 9 rgb 150 fade_power 2 fade_distance 3}
//light_source {<-1, 4, 3> * 8 rgb 240*.875 fade_power 2 fade_distance 2}

//---Textures--------------------------------------------------------------
#declare RS = seed(0);

#declare CM_Clouds =
color_map {
    [0.0   rgb 1]
    [0.05  rgb 0.85]
    [0.20  rgb 0.75]
    [0.45 SkyBlue]
}

#declare T_Clouds =
texture{
  pigment {
    bozo
    color_map {CM_Clouds}

    warp{
      turbulence 0.175
      octaves 7
      omega 0.7
      lambda 2.25
    }
  }
  finish{ambient 0.9 diffuse 0.2}
}

#declare FShiny =
finish{
  //ambient 0.05 diffuse .85
  specular .75 roughness 3e-4
  //metallic
  phong .25 phong_size 1.5
  reflection .25 diffuse .75  ambient 0
  //reflection {0.45,.75 metallic 0} diffuse .35 ambient 0
}

#declare TGround =
texture{
  pigment{
    //crackle  //solid
    //cells
    wrinkles
    //color_map{[0 rgb 1][0.025 rgb .25][0.1 rgb .75][0.15 rgb <.85 .75
..65>][1 rgb 1]}
    color_map {[0 rgb 1][0.025 rgb .25][0.1 rgb .75][0.15 rgb .85][1 rgb 1]}
    scale 2 // 10
  }
  finish{
    ambient .05 diffuse .75
    specular .75 roughness 1e-3
    //reflection .05 diffuse .60 ambient 0
  }
}

#declare StoneMax=30;

#declare T_Stones = array[StoneMax]{
  T_Stone1, T_Stone2, T_Stone3, T_Stone4, T_Stone5,
  T_Stone6, T_Stone7, T_Stone8, T_Stone9, T_Stone10,
  T_Stone11, T_Stone12, T_Stone13, T_Stone14, T_Stone15,
  T_Stone16, T_Stone17, T_Stone18, T_Stone19, T_Stone20,
  T_Stone21, T_Stone22, T_Stone23, T_Stone24, T_Stone25,

  //T_Stone26, T_Stone27,
  T_Stone29, T_Stone30, T_Stone31,
  T_Stone32, T_Stone33,
}
//#declare StoneMax=35;

#declare Sat = 0.625;
#declare Val = 0.65;

#declare Sat = 0.55;
#declare Val = 0.60;

#declare Sat = 0.60;
#declare Val = 0.75;

#macro Tex(A)
  //texture{T_Stone17 scale 4*2 translate 10*rand(RS)}
  texture{
    pigment{color CHSV2RGB(<A*360, Sat, Val>)
      //filter .75 transmit 0.25
    }
    finish{FShiny}
  }
#end

//---Objects-------------------------------------------

#declare Ground = cylinder{-y, -1e-4*y, SkyRad/20 texture{TGround}}

//Convert 2D to 3D
#macro V3D(A, H)<A.u,H,A.v>#end

//Generalized Rounded Prism
#macro RPrism(Vtx, Sides, SH, SR)
  //merge{
  union{
  #if(1)
    prism{
      linear_spline 0, SH, Sides+1,
      #local I=0;
      #while(I<=Sides)
        Vtx[I]
        #local I=I+1;
      #end
    }
    #end

    #local SH1 = SH - SR;
    #local I=0;
    #while(I<Sides)
      #local II = mod(I+1,Sides);
      #local A0 = V3D(Vtx[I],0);
      #local A1 = V3D(Vtx[I],SH1);
      #local DV = Vtx[II]-Vtx[I];
      #local Ang = -atan2(DV.y,DV.x)*180/pi;

      sphere{A1, SR}
      cylinder{0, SH1*y, SR translate A0}
      cylinder{A1, V3D(Vtx[II],SH1), SR }

      //cylinder{A0, V3D(Vtx[II],0), SR pigment{rgb y}}
      //sphere{A0, SR}

      #local Panel = box{z*1e-3, <vlength(DV), SH1, SR>}   //Side panel
      object{Panel rotate y*Ang translate A0}

      #local I=I+1;
    #end
  }
#end

//Clear a 2D array to zeroes
#macro Clear_2D(A)
  #local MI=dimension_size(A, 1);
  #local MJ=dimension_size(A, 2);

  #local I=0;
  #while(I<MI)
    #local J=0;
    #while(J<MJ)
      #local A[I][J] = 0;
      #local J=J+1;
    #end
    #local I=I+1;
  #end
#end

//Build a new vertex for MakeList()
#macro NewVertex(DI, DJ)
  #if((A[I+DI][J]!=Num & A[I][J+DJ]!=Num) | (A[I+DI][J]=Num & A[I][J+DJ]=Num
& A[I+DI][J+DJ]!=Num))

    #declare V = V + 1;
    #local KI = 2*I+(DI>0);
    #local KJ = 2*J+(DJ>0);
    #declare Knr[KI][KJ] = V;

    #local KI = 2*I+(DI>0?2-SR:SR);
    #local KJ = 2*J+(DJ>0?2-SR:SR);
    #declare Vtx0[V] = <KJ-MJ, MI-KI>;
 #end
#end

//Build vertex list from cell array.
#macro MakeList(A, Num, SR)
  #local MI=dimension_size(A, 1);
  #local MJ=dimension_size(A, 2);

  #local Knr = array[2*MI][2*MJ]
  Clear_2D(Knr)

  #local MV = 4*(MI-2)*(MJ-2);
  #local Vtx0 = array[MV];

  //Find vertices
  #local V=0;
  #local I=1;
  #while(I<MI-1)
    #local J=1;
    #while(J<MJ-1)
      #if(A[I][J]=Num)
        NewVertex(-1, -1)  //top left
        NewVertex(-1,  1)  //top right
        NewVertex( 1,  1)  //bottom right
        NewVertex( 1, -1)  //bottom left
      #end
      #local J=J+1;
    #end
    #local I=I+1;
  #end

  #local MV = V + 1;
  #local EV = array[MV];
  #local EH = array[MV];
  #local Vtx = array[MV];

  #local KV = 0;
  #local KH = 0;

  //find horizontal edges
  #local I=2;
  #while(I<2*MI-2)
    #local inedge = 0;
    #local J=2;
    #while(J<2*MJ-2)
      #local Knum = Knr[I][J];
      #if(Knum)
        #if(inedge)
          #local EH[Knum] = Vnum;
          #local EH[Vnum] = Knum;
        #else
          #local Vnum = Knum;
        #end
        #local inedge = !inedge;
      #end
      #local J=J+1;
    #end
    #local I=I+1;
  #end

  //find vertical edges
  #local J=2;
  #while(J<2*MJ-2)
    #local inedge = 0;
    #local I=2;
    #while(I<2*MI-2)
      #local Knum = Knr[I][J];
      #if(Knum)
        #if(inedge)
          #local EV[Knum] = Vnum;
          #local EV[Vnum] = Knum;
        #else
          #local Vnum = Knum;
        #end
        #local inedge = !inedge;
      #end
      #local I=I+1;
    #end
    #local J=J+1;
  #end

  //Find perimeter, starting from vertex 1 following  horizontal direction
  #local Knum = 1;
  #local Vtx[0] = Vtx0[1];
  //#debug"1"
  #local I=1; #local Vert = 0;
  #while(I<MV)
    #local Knum = (Vert ? EV[Knum] : EH[Knum]);
    #local Vtx[I] = Vtx0[Knum];
    #local I=I+1; #local Vert = !Vert;
  #end

  Vtx
#end

#macro Polyominos(Polys, Num, SH, SR)
union{
  #local I=1;
  #while(I<=Num)
    #local Vtx = MakeList(Polys, I, SR)
    object{
      RPrism(Vtx, dimension_size(Vtx, 1)-1, SH, SR)
      texture{T_Stones[mod(11+floor(StoneMax*(I-1)/Num), StoneMax)] scale 8
translate 10*rand(RS)}
      //texture{T_Stones[(mod(I,2)?16:27)] scale 8 translate 10*rand(RS)}
      //Tex((I-1)/Num)
      //texture{T_Stone21 scale 34}
    }
    #local I=I+1;
  #end
}
#end

//--------------------------The actual scene-------------------

#declare CMGray = color_map {[0.2 rgb 0.25][0.8 rgb .75]}

#declare CMBlue = color_map {
  [0.0 rgb <.1, .15, .5>]
  [0.6 rgb <.8,.8,1>]
  [.8 rgb 1]
  [1 rgb <1,1,.9>]
}

#declare Sky0 =
sphere{-y*SkyRad*.9, SkyRad
  inverse
  no_shadow
  texture{
    T_Clouds
    scale <1 .85 1> * SkyRad/10 rotate 25*y
  }
}

#declare Sky1 =
sphere {0,1 inverse
  pigment {
    function{abs(y)}
    color_map {
      CMGray
      //CMBlue
    }
  }
  finish{ambient 0.1 diffuse 0.85}
  scale SkyRad
}

#if(1)
  object{Sky0}
#else
  //background{SkyBlue}
  background{rgb .5}
  //background{rgb 0}
#end

object{Ground}

//Raw polyomino array
#declare Polys = array[6][9]
{
  {0, 0, 0, 0, 0, 0, 0, 0, 0},
  {0, 1, 1, 1, 1, 2, 2, 2, 0},
  {0, 3, 3, 3, 4, 4, 2, 7, 0},
  {0, 3, 5, 5, 6, 4, 4, 7, 0},
  {0, 5, 5, 6, 6, 6, 7, 7, 0},
  {0, 0, 0, 0, 0, 0, 0, 0, 0},
}

//#include "SqSpiral1.inc"
//#include "tetM.inc"
//#include "432.inc"
#include "penta.inc"
//#include "5432.inc"

#declare H = 2.0;
#declare R = 0.5; // 0.75;

object{
  //Polyominos(Polys, 7, H, R)
  //Polyominos(Polyomino, 2, H, R)    //SqSpiral
  //Polyominos(Polyomino100, 10, H, R)    //tetM
  //Polyominos(Polyomino1, 10, H, R)    //432
  Polyominos(Polyomino2, 18, H, R)      //penta
  //Polyominos(Polyomino4, 27, H, R)      //5432

  //rotate -x*90
  //rotate y*-90
  //translate <-2, 0, 1>
}

//-------------------------End of file-------------------------


Post a reply to this message


Attachments:
Download 'rprismdi1s.jpg' (110 KB)

Preview of image 'rprismdi1s.jpg'
rprismdi1s.jpg


 

From: Larry Hudson
Subject: Re: Rounded Prisms
Date: 25 Nov 2005 21:11:55
Message: <4387c46b$1@news.povray.org>
PM 2Ring wrote:
> Oops! Wrong image! Oh well, I did intend to post that one, too, eventually.
> :)
> 
> Here's Penrose Place.
> 
Nice.  But I'm a bit bothered with the railing and horizon being 
coincident.  I think raising (or lowering) the camera a tad to separate 
them would look better.  :-)

      -=- Larry -=-


Post a reply to this message

From: repiv
Subject: Re: Rounded Prisms
Date: 26 Nov 2005 02:03:28
Message: <438808c0@news.povray.org>
PM 2Ring wrote:
> repiv <me### [at] privatenet> wrote:
>>I wrote a macro for this once, with variable radii for each vertex. Never
>>quite finished it.
>>
>>Attached is a demo render, no HDRI, radiosity or checkered floor though, I
>>apologize.
> 
> Beautiful, repiv. Are you using a torus?

Yes, actually depending on the radius it is a torus, sphere or lemon. The 
math is quite coherent really, there isn't much difference between a convex 
or concave corner either.

BTW, sorry everyone for the large image file in my post, I forgot to 
compress it.


Post a reply to this message

From: PM 2Ring
Subject: Re: Rounded Prisms
Date: 28 Nov 2005 01:25:00
Message: <web.438aa1af7ed7ae6cad93754b0@news.povray.org>
Larry Hudson <org### [at] yahoocom> wrote:
> PM 2Ring wrote:

> > Here's Penrose Place.
> >
> Nice.  But I'm a bit bothered with the railing and horizon being
> coincident.  I think raising (or lowering) the camera a tad to separate
> them would look better.  :-)
>
>       -=- Larry -=-

Good point, Larry, but I placed the railing there on purpose to hide the
sharp horizon line. Eventually, I'd like to do a bit of haze, and more
realistic clouds. And probably use Jaime's LightSys as well.


Post a reply to this message

From: PM 2Ring
Subject: Re: Rounded Prisms
Date: 30 Nov 2005 08:00:00
Message: <web.438da2327ed7ae6c3dc12f230@news.povray.org>
"PM 2Ring" <nomail@nomail> wrote:

> The polyomino tesselations were found by a C program I wrote years ago on
> the Amiga. I can post it (source & Linux binary) as well, if anyone wants
> it.

See povray.utilities.binaries for my Blocks program. As usual, all feedback
is welcome.


Post a reply to this message

From: PM 2Ring
Subject: Re: Rounded Prisms
Date: 30 Nov 2005 08:10:01
Message: <web.438da3ac7ed7ae6c3dc12f230@news.povray.org>
"PM 2Ring" <nomail@nomail> wrote:
> "PM 2Ring" <nomail@nomail> wrote:
>
> > The polyomino tesselations were found by a C program I wrote years ago on
> > the Amiga. I can post it (source & Linux binary) as well, if anyone wants
> > it.
>
> See povray.utilities.binaries for my Blocks program. As usual, all feedback
> is welcome.

Of course, that should be povray.binaries.utilities! I just tried to DL the
archive & Windows2000 can't open it. :( The archive was created in Linux.

This has happened to me before. I think it's a bug with the Web interface...

If anyone has success opening this thing, please let me know!


Post a reply to this message

From: Fredrik Eriksson
Subject: Re: Rounded Prisms
Date: 30 Nov 2005 09:16:42
Message: <op.s014myhncs6ysw@frogeater.bredbandsbolaget.se>
On Wed, 30 Nov 2005 14:05:48 +0100, PM 2Ring <nomail@nomail> wrote:
> "PM 2Ring" <nomail@nomail> wrote:
>> See povray.utilities.binaries for my Blocks program. As usual, all  
>> feedback
>> is welcome.
>
> Of course, that should be povray.binaries.utilities! I just tried to DL  
> the
> archive & Windows2000 can't open it. :( The archive was created in Linux.
>
> This has happened to me before. I think it's a bug with the Web  
> interface...
>
> If anyone has success opening this thing, please let me know!


No problem here, using WinRAR 3.51. What software are you using to open it?



-- 
FE


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 6 Messages >>>

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