POV-Ray : Newsgroups : povray.text.scene-files : The BTFH (WIP September 2018) Server Time
28 Mar 2024 18:58:44 EDT (-0400)
  The BTFH (WIP September 2018) (Message 1 to 1 of 1)  
From: BGimeno
Subject: The BTFH (WIP September 2018)
Date: 7 Sep 2018 03:32:32
Message: <5b922990@news.povray.org>
// PoV-Ray 3.7 Scene File "TBTSFH.pov"
// author: B. Gimeno
// date: August-September 2018
// Work in progress, not finished
/*
  Some slashes and comment blocks added to the code to speed up tests. 
No radiosity and no focal blur here. On your own and risk.

Intel® Core™ i7-3770 CPU @ 3.40GHz × 8
Ubuntu 18.04.1 LTS

Render Time:
   Photon Time:      No photons
   Radiosity Time:   0 hours 24 minutes  1 seconds (1441.334 seconds)
               using 8 thread(s) with 11340.966 CPU-seconds total
   Trace Time:       6 hours  1 minutes 38 seconds (21698.912 seconds)
               using 8 thread(s) with 172774.191 CPU-seconds total


*/
//------------------------------------------------------------------------
#version 3.7;
global_settings{ assumed_gamma 1.0 }
#default{ finish{ ambient 0.1 diffuse 0.9 }}
//------------------------------------------------------------------------
#include "colors.inc"
#include "textures.inc"
#include "glass.inc"
#include "metals.inc"
#include "golds.inc"
#include "stones.inc"
#include "woods.inc"
#include "shapes.inc"
#include "shapes2.inc"
#include "functions.inc"
#include "math.inc"
#include "transforms.inc"
#include "rad_def.inc"
/*
global_settings {
    radiosity {
       Rad_Settings(Radiosity_OutdoorHQ,off,off)
    }
}
*/
#default {finish{ambient 0}}

//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
#declare Camera_Number = 1 ;
//---------------------------------------------------------------------------------
// camera 
-------------------------------------------------------------------------
#switch ( Camera_Number )
#case (0)
   #declare Camera_Location = < 0.00, 1.00,-40.00> ;  // front view
   #declare Camera_Look_At  = < 0.00, 1.00,  0.00> ;
   #declare Camera_Angle    =  15 ;
#break
#case (1)
   #declare Camera_Location =  <25.0 , 20.0 ,-25.0> ;  // diagonal view
   #declare Camera_Look_At  =  < 0.0 , 1.0 , 0.0> ;
   #declare Camera_Angle    =  15 ;
#break
#case (2)
   #declare Camera_Location = < 3.0, 1.0 , 0.0> ;  // right side view
   #declare Camera_Look_At  = < 0.0, 1.0,  0.0> ;
   #declare Camera_Angle    =  90 ;
#break
#case (3)
   #declare Camera_Location = < 0.00, 5.00,  0+0.000> ;  // top view
   #declare Camera_Look_At  = < 0.00, 0.00,  0+0.001> ;
   #declare Camera_Angle    = 90 ;
#break
#else
   #declare Camera_Location = < 0.00, 1.00, -6> ;  // front view
   #declare Camera_Look_At  = < 0.00, 1.00,  0.00> ;
   #declare Camera_Angle    =  75 ;
#break
#break
#end // of "#switch ( Camera_Number )"
//--------------------------------------------------------------------------

camera{ // ultra_wide_angle // orthographic
         location Camera_Location
         right    x*image_width/image_height
         angle    Camera_Angle
         look_at  Camera_Look_At
       }

/*
// camera with focal blur:
camera{ perspective // default
         location Camera_Location
         angle    Camera_Angle
         right    x*image_width/image_height
         look_at  Camera_Look_At
       // focal blur settings:
         focal_point < 0.00, 1, 0.10>
         aperture .9     // 0.05 ~ 1.5
         blur_samples 300 // 4 ~ 100
         confidence 0.9   // 0 ~ 1
         variance 1/512   // 1/64 ~ 1/1024 ~
       } //---------------------------------
*/
//------------------------------------------------------------------------
// sun -------------------------------------------------------------------
light_source{<-500,2000,-2000> color rgb<1,1,1>*0.9}                // sun
light_source{ Camera_Location   color rgb<0.9,0.9,1>*0.1 shadowless}// flash

// sky -------------------------------------------------------------------
background {colour Black}
//------------------------------------------------------------------------ 

plane { <0,1,0>, 0
          pigment{
             pavement
             number_of_sides 3
             number_of_tiles 1
             pattern 1
             exterior 2
             interior 1
             form 0
                 color_map{[0.000   color rgbt<1,1,1,0>]
                           [0.950   color rgbt<1,1,1,0>]
                           [0.960   color rgbt<0.6,0.5,0.5,0>]
                           [1.000   color rgbt<0.6,0.5,0.5,0>]
                           }
            frequency 1
            turbulence 0
            scale 1.25
          }

       finish {reflection .25}
}

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

#macro CW_angle (COLOR,A)
    #local RGBFT = color COLOR;
    #local R = (RGBFT.red);
    #local G = (RGBFT.green);
    #local B = (RGBFT.blue);
    #local Min = min(R,min(G,B));
    #local Max = max(R,max(G,B));
    #local Span = Max-Min;
    #local H = CRGB2H (<R,G,B>, Max, Span);
    #local S = 0; #if (Max!=0) #local S = Span/Max; #end

    #local Pg = <H+A,S,Max,(RGBFT.filter),(RGBFT.transmit)> ;

    #local HSVFT = color Pg ;
    #local H = (HSVFT.red);
    #local S = (HSVFT.green);
    #local V = (HSVFT.blue);
    #local SatRGB = CH2RGB(H);
    #local RGB = ( ((1-S)*<1,1,1> + S*SatRGB) * V );
    rgb <RGB.red,RGB.green,RGB.blue>
    //rgb <RGB.red,RGB.green,RGB.blue,(HSVFT.filter),(HSVFT.transmit)>
#end
//---------------------------- objects in scene ----------------------------

#macro TBTSFH (
                major_rA,major_rB,
                minor_rA,minor_rB,
                minor_r2,
                mj_n,
                mn_n,
                lumps_n,lumps_r,lumps_start
                s_type,
                R,
                arc_major_r_begins,
                major_r_ends,
                arc_minor_r_begins,
                minor_r_ends,
                torsion,
                subdv,
                tessellation
                )
union {
  #local mn_n_r = 0 ;
  #while (mn_n_r<mn_n)
  #local mj_n_r = 0 ;
  #while (mj_n_r<mj_n)

  #local sd1 = seed ((mn_n_r+19)+(mj_n_r*73)) ;
    //*****
    #macro P (X,Y,minor_r2)
     // Point of origin
     #local p0 = <0,0,0>;

     // Transfer to radius minorA + radio minor_r2
     #local pf = ((minor_rA-minor_rB)/mj_n)*(mj_n_r+Y) ;
     #local pa = transform {translate <0,0,minor_rA+(pf)+minor_r2>} ;
     #local p2 = vtransform (p0,pa);

     // Transfer to lumps along minor radius
     #local pb = transform {translate 
<0,0,lumps_r*sind(((major_r_ends*lumps_n)/mj_n)*(mj_n_r+X+lumps_start))>} ;
     #local p3 = vtransform (p2,pb);

     // Transfer to the beginning of arc minor_r_begins
     #local p31 = vrotate (p3,x*arc_minor_r_begins);

     // Minor radius arc
     #local p4 = vrotate (p31,x*((minor_r_ends/mn_n)*(mn_n_r+Y)));

     // Torsion rotation lower radius
     #local p45 = vrotate (p4,x*(torsion/mj_n)*(mj_n_r+X));

     // Transfer to major radius and adjustment of change in the major 
radius
     #local pd = ((major_rA-major_rB)/mj_n)*(mj_n_r+X) ;
     #local pe = transform {translate <0,0,major_rA+pd>} ;
     #local p6 = vtransform (p45,pe);

     // Transfer to the beginning of arc major_r_begins
     #local p7 = vrotate (p6,y*arc_major_r_begins);

     // Major Radius arc
     #local p8 = vrotate (p7,y*((major_r_ends/mj_n)*(mj_n_r+X)));

     p8

     #end
    //*****
    #switch (s_type)
    #case (1) // cylinders
      #switch (tessellation)
      #case (1) // rectangular
    union {
      #local subdv_rx = 0 ; #while (subdv_rx<subdv)
      #local subdv_ry = 0 ; #while (subdv_ry<subdv)
        union {
        sphere {P(subdv_rx,0,0),R}
        sphere {P(0,subdv_ry,0),R}
        cylinder {P(subdv_rx,0,0),P(subdv_rx+(1/subdv),0,0),R}
        cylinder {P(0,subdv_ry,0),P(0,subdv_ry+(1/subdv),0),R}
        pigment {White}
        }

        triangle {P(subdv_rx,subdv_ry,0),
                  P(subdv_rx+((1/subdv)*.5),subdv_ry+((1/subdv)*.5),0),
                  P(subdv_rx+(1/subdv),subdv_ry,0)}
        triangle {P(subdv_rx+(1/subdv),subdv_ry,0),
                  P(subdv_rx+((1/subdv)*.5),subdv_ry+((1/subdv)*.5),0),
                  P(subdv_rx+(1/subdv),subdv_ry+(1/subdv),0)}
        triangle {P(subdv_rx+(1/subdv),subdv_ry+(1/subdv),0),
                  P(subdv_rx+((1/subdv)*.5),subdv_ry+((1/subdv)*.5),0),
                  P(subdv_rx,subdv_ry+(1/subdv),0)}
        triangle {P(subdv_rx,subdv_ry+(1/subdv),0),
                  P(subdv_rx+((1/subdv)*.5),subdv_ry+((1/subdv)*.5),0),
                  P(subdv_rx,subdv_ry,0)}

       //----
       #if(mj_n_r=mj_n-1) // complete if mesh is at the end of X_r
        cylinder 
{P(subdv_rx+(1/subdv),subdv_ry,0),P(subdv_rx+(1/subdv),subdv_ry+(1/subdv),0),R}
        sphere {P(subdv_rx+(1/subdv),0,0),R }
       #end
       #if(mn_n_r=mn_n-1) // complete if mesh is at the end of Y_r
        cylinder 
{P(subdv_rx,subdv_ry+(1/subdv),0),P(subdv_rx+(1/subdv),subdv_ry+(1/subdv),0),R}
        sphere {P(0,subdv_ry+(1/subdv),0),R}
       #end
       //----
      #local subdv_ry = subdv_ry + (1/subdv) ; #end
      #local subdv_rx = subdv_rx + (1/subdv) ; #end
      texture {
             pigment { CW_angle 
(Red*.9,((360/mj_n)*(mj_n_r+0.5)))+(0.25*sind(360*rand(sd1)))
                       }
                }

       translate <0,R+minor_rA+lumps_r,0>
       }
    #break
    #case (2) // hexagonal
     union {
       sphere {P(0,0,0),R }

       cylinder {P(0,0,0),P(1/3,0,0),R}
       cylinder {P(1/3,0,0),P(1/2,1/2,0),R}
       cylinder {P(1/2,1/2,0),P(5/6,1/2,0),R}
       cylinder {P(5/6,1/2,0),P(1,1,0),R}
       cylinder {P(1,1,0),P(5/6,3/2,0),R}
       cylinder {P(5/6,3/2,0),P(1/2,3/2,0),R}
       cylinder {P(1/2,3/2,0),P(1/3,1,0),R}
       cylinder {P(1/2,1/2,0),P(1/3,1,0),R}


       triangle {P(0,0,0),P(1/3,0,0),P(1,0,0)}
       triangle {P(1,0,0),P(.5,.5,0),P(1,1,0)}
       triangle {P(1,1,0),P(.5,.5,0),P(0,1,0)}
       triangle {P(0,1,0),P(.5,.5,0),P(0,0,0)}
       translate <0,R+minor_rA+lumps_r,0>
       }
    #break
    #end // switch tesselation
    #break
    #case (2) // sphere_sweep
    #switch (tessellation)
      #case (1) // rectangular
    union {
      union {
       sphere_sweep {
        cubic_spline 6,P(-1/3,0,0),R, P(0,0,0),R, P(1/3,0,0),R, 
P(2/3,0,0),R, P(1,0,0),R, P(1+(1/3),0,0),R
        tolerance 0.1 }
       sphere_sweep {
        cubic_spline 6, P(0,-1/3,0),R, P(0,0,0),R,P(0,1/3,0),R, 
P(0,2/3,0),R, P(0,1,0),R, P(0,1+(1/3),0),R
        tolerance 0.1 }

       #if(mj_n_r=mj_n-1)// complete if mesh is at the end of X_r
        sphere_sweep {
        cubic_spline 6, P(1,-1/3,0),R, P(1,0,0),R,P(1,1/3,0),R, 
P(1,2/3,0),R, P(1,1,0),R, P(1,1+(1/3),0),R
        tolerance 0.1 }

       #end
       #if(mn_n_r=mn_n-1)// complete if mesh is at the end of Y_r
        sphere_sweep {
        cubic_spline 6, P(-1/3,1,0),R, P(0,1,0),R, 
P(1/3,1,0),R,P(2/3,1,0),R, P(1,1,0),R, P(1+(1/3),1,0),R
        tolerance 0.1 }

       #end

       texture {
             pigment { White }
             finish {reflection 0 metallic }
             }
        }// union sphere_sweep
   #local subdv_rx = 0 ;    #while (subdv_rx<subdv)
   #local subdv_ry = 0 ;    #while (subdv_ry<subdv)

       bicubic_patch {
       type 1
       flatness 0.1
       u_steps 4
       v_steps 4
       P((1/subdv)*subdv_rx,(1/subdv)*(subdv_ry),0), // row 1 col 1
       P((1/subdv)*(subdv_rx+(1/3)),(1/subdv)*(subdv_ry),0),// row 1 col 2
       P((1/subdv)*(subdv_rx+(2/3)),(1/subdv)*(subdv_ry),0),// row 1 col 3
       P((1/subdv)*(subdv_rx+1),(1/subdv)*(subdv_ry),0), // row 1 col 4

       P((1/subdv)*subdv_rx,(1/subdv)*(subdv_ry+(1/3)),0), // row 2 col 1
       P((1/subdv)*(subdv_rx+(1/3)),(1/subdv)*(subdv_ry+(1/3)),0), // 
row 2 col 2
       P((1/subdv)*(subdv_rx+(2/3)),(1/subdv)*(subdv_ry+(1/3)),0), // 
row 2 col 3
       P((1/subdv)*(subdv_rx+1),(1/subdv)*(subdv_ry+(1/3)),0), // row 2 
col 4

       P((1/subdv)*subdv_rx,(1/subdv)*(subdv_ry+(2/3)),0), // row 3 col 1
       P((1/subdv)*(subdv_rx+(1/3)),(1/subdv)*(subdv_ry+(2/3)),0), // 
row 3 col 2
       P((1/subdv)*(subdv_rx+(2/3)),(1/subdv)*(subdv_ry+(2/3)),0), // 
row 3 col 3
       P((1/subdv)*(subdv_rx+1),(1/subdv)*(subdv_ry+(2/3)),0), // row 3 
col 4

       P((1/subdv)*subdv_rx,(1/subdv)*(subdv_ry+1),0), // row 4 col 1
       P((1/subdv)*(subdv_rx+(1/3)),(1/subdv)*(subdv_ry+1),0), // row 4 
col 2
       P((1/subdv)*(subdv_rx+(2/3)),(1/subdv)*(subdv_ry+1),0), // row 4 
col 3
       P((1/subdv)*(subdv_rx+1),(1/subdv)*(subdv_ry+1),0) // row 4 col 4 


  // end of bicubic_patch 
----------------------------------------------------------

       }
   #local subdv_ry = subdv_ry+1 ;  #end // subdv_r loop-while
   #local subdv_rx = subdv_rx+1 ;  #end // subdv_r loop-while

        texture {
             pigment { CW_angle 
(Red,((360/mj_n)*mj_n_r))+(0.1*sind(360*rand(sd1)))
                       }
             finish {reflection 0 metallic }
             }
       translate <0,R,0>
       translate <0,minor_rA+lumps_r,0>
}
    #break
    #case (2) // hexagonal
      union {
     sphere_sweep { cubic_spline 4, P(-1/3,0,0),R,    P(0,0,0),R,
                                    P(1/3,0,0),R,     P(2/3,0,0),R 
tolerance 0.1 }
     sphere_sweep { cubic_spline 4, P(1/6,-1/2,0),R,  P(1/3,0,0),R,
                                    P(1/2,1/2,0),R,   P(1/3,1,0),R 
tolerance 0.1 }
     sphere_sweep { cubic_spline 4, P(1/6,1/2,0),R,   P(1/2,1/2,0),R,
                                    P(5/6,1/2,0),R,   P(7/6,1/2,0),R 
tolerance 0.1 }
     sphere_sweep { cubic_spline 4, P(2/3,0,0),R,     P(5/6,1/2,0),R,
                                    P(1,1,0),R, P(7/6,3/2,0),R tolerance 
0.1 }
     sphere_sweep { cubic_spline 4, P(7/6,1/2,0),R,   P(1,1,0),R,
                                    P(5/6,3/2,0),R, P(2/3,2,0),R 
tolerance 0.1 }
     sphere_sweep { cubic_spline 4, P(2/3,0,0),R, P(1/2,1/2,0),R,
                                    P(1/3,1,0),R, P(1/6,3/2,0),R 
tolerance 0.1 }


union {
     triangle {P(0,0,0),P(1/6,1/2,0),P(1/3,0,0)}
     triangle {P(1/3,0,0),P(1/6,1/2,0),P(1/2,1/2,0)}
     triangle {P(1/2,1/2,0),P(1/6,1/2,0),P(1/3,1,0)}
     triangle {P(1/3,1,0),P(1/6,1/2,0),P(0,1,0)}
     triangle {P(0,1,0),P(1/6,1/2,0),P(-5/6,1/2,0)}
     triangle {P(-1/6,1/2,0),P(1/6,1/2,0),P(0,0,0)}
        texture {
             pigment { CW_angle 
(Red*.9,((360/mj_n)*(mj_n_r)))+(0.25*sind(360*rand(sd1)))
                       }
                }
}
union {
     triangle {P(1/2,1/2,0),P(5/6,1,0),P(5/6,1/2,0)}
     triangle {P(5/6,1/2,0),P(5/6,1,0),P(1,1,0)}
     triangle {P(1,1,0),P(5/6,1,0),P(5/6,3/2,0)}
     triangle {P(5/6,3/2,0),P(5/6,1,0),P(1/2,3/2,0)}
     triangle {P(1/2,3/2,0),P(5/6,1,0),P(1/3,1,0)}
     triangle {P(1/3,1,0),P(5/6,1,0),P(1/2,1/2,0)}
        texture {
             pigment { CW_angle 
(Red*.9,((360/mj_n)*(mj_n_r+0.5)))+(0.25*sind(360*rand(sd1)))
                       }
                }
}

       translate <0,R,0>
       translate <0,max(minor_rA,minor_rB)+lumps_r,0>
}
    #break
    #end

#break
#end

  #local mj_n_r = mj_n_r +1 ;
  #end
  #local mn_n_r = mn_n_r +1 ;
  #end
/*
torus {max(major_rA,major_rB),max(minor_rA,minor_rB)  translate 
y*max(minor_rA,minor_rB)
        pigment {White}
        }
*/
}

#end
//--------------------------------------------------------------------------

object {TBTSFH (3, // major_rA, major radius at the beginning of the shape
                 3, // major_rB, major radius at the end of the shape
               .75, // minor_rA, minor radius at the beginning of the shape
               .75, // minor_rB, minor radius at the beginning of the shape
                 0,// minor_r2, (not in use) height above the surface of 
the shape, used as alternative inner radius

              90, // mj_n, number of cells around the greater radius
              12, // mn_n, number of cells around the smaller radius


                 3, // lumps_n, number of protuberances around the 
greater radius
                .15, // lumps_r, maximum divergence of the protuberances 
over minor radius
                 0, // lumps_start, (still not implemented) 
protuberances start at

                2, // s_type, choose between
                       // 1=cylinders+triangles
                       // 2=cubic_splines+bezier_patch

               .015, // R, thickness of the cylinders that make up the grid

                0, // arc_major_r_begins ; the arc formed by greater 
radius starts at "degrees"
               360, // major_r_ends ; the arc formed by greater radius 
complete "n-degrees"

                0, // arc_minor_r_begins ; the arc formed by smaller 
radius starts at "degrees"
              310, // minor_r_ends ; the arc formed by smaller radius 
complete "n-degrees"

              360*5, // degrees of torsion around the minor radius

                5, // grid subdivision (lower-less grid quality -> 
higher-parses as a dead tortoise)

                1, // tesellation:
                       // 1 rectangular
                       // 2 hexagonal
                )
         texture {
           pigment {White}
           finish {reflection 0.35
                   metallic
                   }
           }
         }

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


Post a reply to this message

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