POV-Ray : Newsgroups : povray.text.scene-files : poor attempt at greebles / hull plating Server Time
1 Nov 2024 07:26:56 EDT (-0400)
  poor attempt at greebles / hull plating (Message 1 to 1 of 1)  
From: Pete
Subject: poor attempt at greebles / hull plating
Date: 29 Aug 2001 22:46:23
Message: <16581.641T2197T13635666PeterC@nym.alias.net>
On povray.general someone brought up the subject of greebles
(late 70's SF hull plates) again.

So here is a scene that I started ahwile ago and ran out
of steam on.  In the mess of spagheti pov code are some
macros I wrote that make greebles.  Maybe someout out there
can use it as a starting point for a better greeble
generator.

The line wrapping will kill this file, *sigh* ....


-- 
-- begin pachubek_02.pov --
--

/* clusters of rectangular blockoids around sphere which

   has a blue glow around it.  Very tech.  Very 10th. 

   It doesn't look cool yet though. */



#declare ntsc = false;

#declare rseed = seed(27987642);

#declare our_gamma = 2.2;  // brighter than usual

#declare which_view = 1;

#declare overlay = false;

#declare glow_radius = 8;

#declare glow_hue = <0, 0.6, 1>;

#declare sphere_radius = 4;  // must be less than glow_radius

#declare cut_depth = 0.02;





global_settings {

  assumed_gamma our_gamma

  number_of_waves 11

  max_trace_level 16

  radiosity {

    brightness 3.3 // defualt value if 3.3

    count 100 // default value is 100

    error_bound 0.1

    distance_maximum 11 // guess - 11 times the hieght of the object

  }

}





#macro rnd_rotate()

  rotate <360 * rand(rseed), 360 * rand(rseed), 360 * rand(rseed)>

#end





#macro rnd_translate()

  translate <4 - 8 * rand(rseed), 4 - 8 * rand(rseed), 4 - 8 * rand(rseed)>

#end





#macro perturb()

  rnd_translate()

  rnd_rotate()

#end





#macro camera_transforms()

  #switch (which_view)

    #case (0)

      rotate x*17

      rotate y*4

      translate <-1.4, 6.1, -20>

      #break

    #case (1)

      rotate z*15  // batman

      rotate x*10  // point camera down

      rotate y*10  // turn (pan?) to the right

      translate <-4.42, 4.41, -25>

      #break

    #else  // looking DOWN

      rotate x*85

      translate <6, 50, -8>

  #end // end switch

#end





fog {

  distance 400

  color rgb <0, 0.2, 0.4>

}





camera {

  location 0

  direction <0, 0, 1.6>

  #if (ntsc = true)

    right <(640 / 400) * (10 / 11), 0, 0>

  #else

    right <(640/480), 0, 0>

  #end

  up <0, 1, 0>

  camera_transforms()

}





background { color rgb <0, 0.2, 1> * 0.2 }

// http://www.crosswinds.net/~chiasm/bwcontents.html <-- uses electribe ER1 -
*G.G.*





#macro add_text(start_pt, ft_height, the_str)

  text {

    ttf "crystal.ttf" the_str, 0.05, 0

    translate <0, 0, -0.025>

    scale ft_height

    translate start_pt

  }

#end





#if (overlay = true)

  union {

    // text in upper left corner

    add_text(<-0.75, 0.52,         0>, 0.035, "Island: none in range")

    add_text(<-0.75, 0.52 - 0.035, 0>, 0.035, "Status: DEFJAM-1")

    // text in lower right corner

    add_text(<0.3, -0.57 + 0.035, 0>, 0.035, "      overthruster: sined")

    add_text(<0.3, -0.57,         0>, 0.035, "  http://www.whatever.com")

//    cylinder { <0, 0.25, 0>, <0, -0.25, 0>, 0.001 }   // crosshairs

//    cylinder { <0.25, 0, 0>, <-0.25, 0, 0>, 0.001 }

    pigment { color rgb glow_hue }

    finish { ambient 1 diffuse 0 }

    translate <0, 0, 2>

    camera_transforms()

  }

#end





#declare main_texture = texture {

  //pigment { color rgb 1 }

  pigment { color rgb 0.7 }

  finish { ambient 0.2 diffuse 0.8 specular 0.5 roughness 1 }

}





#declare main_texture_dark = texture {

  pigment { color rgb 0 }

  finish { ambient 0.2 diffuse 0.8 }

}





#declare main_texture_darker = texture {

  pigment { color rgb 0.1 }

  finish { ambient 0.2 diffuse 0.8 specular 0.6 }

}





sphere {

  0, 4 - (cut_depth / 2)

  pigment { color rgb glow_hue }

  finish { ambient 1 diffuse 0 }

}





intersection { // central sphere

  sphere { 0, 4 }

  union {

    torus { 4, cut_depth }

    #declare eliv = 90 / 6;

    #while (eliv < 90)

      torus {

        sphere_radius * cos(radians(eliv)), cut_depth

        translate <0, sphere_radius * sin(radians(eliv)), 0>

      }

      torus {

        sphere_radius * cos(radians(eliv)), cut_depth

        translate <0, -sphere_radius * sin(radians(eliv)), 0>

      }

      #declare eliv = eliv + (90 / 6);

    #end

    #declare roty = 0;

    #while (roty < 360)

      torus { sphere_radius, cut_depth rotate z*90 rotate y*roty }

      #declare roty = roty + (360 / 24);

    #end

    inverse

  }

  texture { main_texture_dark }

  bounded_by {

    sphere { 0, sphere_radius + cut_depth + 1.0001 }

  }

}





union { // techie blockoids around the sphere

  #declare cc = 0;

  #while (cc < 500)

    #declare elivation = 90 * rand(rseed);

    #if (rand(rseed) < cos(radians(elivation)))

      #if (rand(rseed) < 0.5)

        #declare elivation = 0 - elivation;

      #end

      #declare roty = 360 * rand(rseed);

      #declare y_size = 0.03 + 0.19 * rand(rseed);

      #declare z_size = 0.06 + 0.14 * rand(rseed);

      #declare x_size = 0.03 + 0.19 * rand(rseed);

      box {

        <4.27, -y_size, -z_size>,

        <4.27 + x_size, y_size, z_size>

        rotate z*elivation

        rotate y*roty

      }

      #declare cc = cc + 1;

    #end

  #end

  texture { main_texture_dark }

}



              

#declare smooth_glow = density {

  spherical

  //scale glow_radius

  color_map {

    [ 0 color rgb glow_hue ]

    [ 1 color rgb glow_hue ]

  }

}





#declare bumpy_glow = density {

  bozo

  scale 1/8

  color_map {

    [ 0.0 color rgb 0 ]

    [ 1.0 color rgb glow_hue ]

  }

}





#declare smooth_absorb = density {

  spherical

  //scale glow_radius

  color_map {

    [ 0 color rgb 1 - glow_hue ]

    [ 1 color rgb 1 - glow_hue ]

  }

}





#declare bumpy_absorb = density {

  bozo

  scale 1/16

  color_map {

    [ 0.0 color rgb 0 ]

    [ 1.0 color rgb 1 - glow_hue ]

  }

}





sphere { // glow around the sphere

  0, glow_radius

  hollow

  pigment { color rgbf 1 }

  finish { ambient 1 diffuse 0 }

  interior {

    media { // glow

      emission 1

      density {

        spherical

        scale glow_radius

        density_map {

          [ 0.0 bumpy_glow ]

          [ sphere_radius / glow_radius smooth_glow ]

        }

      }

      density {

        spherical

        scale glow_radius

        color_map {

          [ 0.0 color rgb 0 ]

          [ sphere_radius / glow_radius color rgb glow_hue / glow_radius ]

          [ sphere_radius / glow_radius color rgb 0 ]

        }

      }

    }

    media { // absorption

      absorption 1

      density {

        spherical

        scale glow_radius

        density_map {

          [ 0.0 bumpy_absorb ]

          [ sphere_radius / glow_radius smooth_absorb ]

        }

      }

      density {

        spherical

        scale glow_radius

        color_map {

          [ 0.0 color rgb 0 ]

          [ sphere_radius / glow_radius color rgb (1 - glow_hue) / glow_radius
]

          [ sphere_radius / glow_radius color rgb 0 ]

        }

      }

    }

  }

}





/* ring of little glows */

#macro ring_blocks_y(ring_rad)

  #local rroty = 0;

  #local ring_gap = (6 / ring_rad) * 9;

  #while (rroty < 360)

    #local b_width = (1 + rand(rseed)) * 0.1; // width of peice

    sphere {

      0, 0.4

      hollow

      no_shadow

      pigment { color rgbf 1 }

      finish { ambient 0.5 diffuse 0.5 }

      interior {

        media {

          emission 1   

          density {    

            spherical  

            // scale 0.2    

            color_map {

              [ 0.6 color rgb 0 ]

              [ 0.8 color rgb glow_hue ]

              [ 1.0 color rgb 1 / 0.3 ] 

            }

          }

        }

        media {

          absorption 1   

          density {    

            spherical  

            // scale 0.2    

            color_map {

              [ 0.6 color rgb 0 ]

              [ 0.8 color rgb 1 - glow_hue ]

              [ 1.0 color rgb 1 / 0.3 ] 

            }

          }

        }

      }

      translate <ring_rad, 0, 0>

      rotate y*rroty

    }

    #local rroty = rroty + ring_gap + ring_gap * 1.333 * rand(rseed);

  #end

#end





union {

  ring_blocks_y(7)

}





// now for some death star tiles in the background - the whole render is now

// inside a textured air shaft





#macro do_quad(c1, c2, c3, c4) // clockwise or counterclockwise order, not
col-row order

  triangle { c1, c2, c3 }

  triangle { c1, c3, c4 }

#end





#macro do_box(c1, c2) // same parameter format as for a box object

  // back wall

  triangle { c1, <c2.x, c1.y, c1.z>, <c2.x, c2.y, c1.z> }

  triangle { c1, <c2.x, c2.y, c1.z>, <c1.x, c2.y, c1.z> }

  // left wall

  triangle { c1, <c1.x, c1.y, c2.z>, <c1.x, c2.y, c2.z> }

  triangle { c1, <c1.x, c2.y, c2.z>, <c1.x, c2.y, c1.z> }

  // right wall

  triangle { <c2.x, c1.y, c2.z>, <c2.x, c1.y, c1.z>, c2 }

  triangle { <c2.x, c1.y, c1.z>, c2, <c2.x, c2.y, c1.z> }

  // bottom

  triangle { <c1.x, c2.y, c2.z>, <c1.x, c2.y, c1.z>, <c2.x, c2.y, c1.z> }

  triangle { <c1.x, c2.y, c2.z>, <c2.x, c2.y, c1.z>, c2 }

  // top

  triangle { <c1.x, c1.y, c2.z>, c1, <c2.x, c1.y, c1.z> }

  triangle { <c1.x, c1.y, c2.z>, <c2.x, c1.y, c1.z>, <c2.x, c1.y, c2.z> }

  // front

  triangle { <c1.x, c1.y, c2.z>, <c2.x, c1.y, c2.z>, c2 }

  triangle { <c1.x, c1.y, c2.z>, c2, <c1.x, c2.y, c2.z> }

#end





#macro rnd(int_max)

  #local rnd_r = int(int_max * rand(rseed));

  rnd_r

#end





#macro rrange(r_low, r_high)

  #local dummy = rand(rseed); // skip a number

  #local real_low = min(r_low, r_high); 

  #local real_high = max(r_low, r_high); 

  #local rresult = rand(rseed) * (real_high - real_low) + real_low;

  rresult

#end





#macro do_poly(numpts, pts)  // pts is an array of points in clockwise or
counterclockwise

// order.  Also: the polygon had better be convex (as in Opticks)

// it can handle noncoplaner although the results might be a bit wrinkly

  #local cc = 1;

  #while (cc < (numpts - 1))

    triangle {

      pts[0],

      pts[cc],

      pts[mod(cc + 1, numpts)]

    }

    #local cc = cc + 1;

  #end

#end





#macro do_cylinder_y( y1, y2, xx, zz, c_radius, num_pts)

  #local pts1 = array[num_pts]

  #local pts2 = array[num_pts]

  #local roty = 0;

  #while (roty < num_pts)

    #local pts1[roty] = <

      c_radius * cos(radians(roty * (360 / num_pts))),

      0,

      c_radius * sin(radians(roty * (360 / num_pts)))

    >;

    #local pts2[roty] = pts1[roty];

    #local pts1[roty] = pts1[roty] + <xx, y1, zz>; // translate

    #local pts2[roty] = pts2[roty] + <xx, y2, zz>; // translate

    #local roty = roty + 1;

  #end

  do_poly(num_pts, pts1)

  do_poly(num_pts, pts2)

  // Ok. endcaps are done.  Now for tubular part

  #local roty = 0;

  #while (roty < num_pts)

    do_quad(

      pts1[roty],

      pts2[roty],

      pts2[mod(roty + 1, num_pts)],

      pts1[mod(roty + 1, num_pts)]

    )

    #local roty = roty + 1;

  #end

#end





#macro do_something(xx, xsize, zz, zsize, ds_height)

  #local d = int(3 * rand(rseed));

  #local thick = (0.4 + 0.6 * rand(rseed)) * ds_height;

  #switch (d)

    #case (0)  // circle

      #local cradius = min(xsize, zsize) / 2;

      #local pos = (<xx, 0, zz> + <xx + xsize, 0, zz + zsize>) / 2;

      do_cylinder_y(

        pos.y, pos.y + thick, xx, zz, cradius, 40 // last number is # of
facets

      )

      #break

    #else  // box

      do_box(<xx, 0, zz>, <xx + xsize, thick, zz + zsize>)

  #end

#end





#macro do_greeble_square(cOords, maxborder, gs_height) // expects a 3-vector. 
ignores y component of vector

  #local cc = 0;

  #local maxradius = 0.95 * maxborder;

  #while (cc < 50)

    // First determine X and Z sizes of the shape

    #local xsize = ((1 + 3 * rand(rseed)) / 12) * maxradius; // 12 was 8,
maybe go to 16?

    #local zsize = ((1 + 3 * rand(rseed)) / 12) * maxradius;

    // Secondly, determine (taking account of the size) the location of the
shape

    #local xx = ((maxradius * 2) - xsize) * rand(rseed) - maxradius;

    #local zz = ((maxradius * 2) - zsize) * rand(rseed) - maxradius;

    // draw the shape

    do_something(cOords.x + xx, xsize, cOords.z + zz, zsize, gs_height)

    #local cc = cc + 1;

  #end

//  // base plate

//  do_box(

//    <cOords.x - maxborder, cOords.y, cOords.z - maxborder>,

//    <cOords.x + maxborder, cOords.y + 0.001, cOords.z + maxborder>

//  )

#end





#macro do_block_tile_r(c1, c2, r_lev, r_dir) // c1 is lower left front , c2 is
upper right back

  #if (r_lev < 1) // stop recursing - actually draw the box

    do_box(c1, c2)

  #else // split up and then recurse

    #local new_r_lev = r_lev - 1;

    #local which_way = rnd(8);

    #if (which_way = 0) // split in same direction as last level

      #local which_way = r_dir;

    #else               // split the other direction as last level

      #if (r_dir = 0)

        #local which_way = 1;

      #else

        #local which_way = 0;

      #end

    #end

    #if (which_way = 0) // split along Z

      // if the size of the block along the Z is too small, strange things

      // may happen when we try to split the blocks.  So we set an
      // arbitrary

      // cutoff at 0.0001 and will not recurse below that size

      #local fudge = abs(c2.z - c1.z) * 0.2;

      #local split_point = rrange(c1.z + fudge, c2.z - fudge);

      #local new_y_back = c2.y - (abs(c2.y - c1.y) * (0.4 * rand(rseed)));

      #local new_y_front = c2.y - (abs(c2.y - c1.y) * (0.4 * rand(rseed)));

      do_block_tile_r(c1, <c2.x, new_y_front, split_point,>, new_r_lev,
which_way) // front one

      do_block_tile_r(<c1.x, c1.y, split_point>, <c2.x, new_y_back, c2.z>,
new_r_lev, which_way) // back one

    #else // split along X

      #local fudge = abs(c2.x - c2.x) * 0.2;

      #local split_point = rrange(c1.x + fudge, c2.x - fudge);

      #local new_y_left = c2.y - (abs(c2.y - c1.y) * (0.4 * rand(rseed)));

      #local new_y_right = c2.y - (abs(c2.y - c1.y) * (0.4 * rand(rseed)));

      do_block_tile_r(c1, <split_point, new_y_left, c2.z>, new_r_lev,
which_way) // left one

      do_block_tile_r(<split_point, c1.y, c1.z>, <c2.x, new_y_right, c2.z>,
new_r_lev, which_way) // right one

    #end

  #end

#end





#macro do_block_tile(c1, c2, r_lev) // c1 is lower left front , c2
// is upper right back
  #local initial_direction = rnd(2);

  do_block_tile_r(c1, c2, r_lev, initial_direction)
#end





// pause to make some tiles
- two algorithms
#macro do_up_a_tile()

  // just use both algorithms.

  do_block_tile(<-1, 0, -1>, <1, 0.07, 1>, 5) // newer method
  do_greeble_square(<0, 0, 0>, 1, 0.09) // older method
#end





#declare tay = array[6]

#declare tay[0] = mesh { do_up_a_tile() }

#declare tay[1] = mesh { do_up_a_tile() }

#declare tay[2] = mesh { do_up_a_tile() }

#declare tay[3] = mesh { do_up_a_tile() }

#declare tay[4] = mesh { do_up_a_tile() }

#declare tay[5] = mesh { do_up_a_tile() }





#declare yy = -400; // plate the walls with hull greebles

#while (yy <= 30)

  #declare roty = 0;

  #while (roty < 360)

    #declare dummy = rand(rseed); // better random?
    object {

      tay[rnd(6)]

      rotate y*90 * int(4 * rand(rseed))

      rotate x*-90

      scale 2.1

      translate <0, yy * 4.15, 30>

      rotate y*roty

      pigment { color rgb <0.5, 0.75, 1> * 0.7 }

      finish { ambient 0.3 diffuse 0.7 }

    }

    #declare roty = roty + 8; // 6

  #end

  #declare yy = yy + 1;

#end





#declare walkway = texture {

  pigment { color rgb 0.6 * <0.5, 0.75, 1> }

  finish { ambient 0.3 diffuse 0.7 }

}





#declare walkway_glow = texture {

  pigment { color rgb <0.5, 0.75, 1> }

  finish { ambient 1 diffuse 0 }

}





#declare walkway_stripe = texture {

  gradient <0, 0, 1>

  texture_map {

    [ 1/2 - 0.1 walkway_glow ]

    [ 1/2 - 0.1 walkway ]

    [ 1/2 + 0.1 walkway ]

    [ 1/2 + 0.1 walkway_glow ]

  }

}





#declare roty = 0;

#while (roty < 360)

  box { // walkway?

    <-0.4, -0.03, -9>, <0.4, 0.03, -30>

    texture {

      gradient <1, 0, 0>

      texture_map {

        [ 0.3 walkway ]

        [ 0.3 walkway_stripe scale 0.9 ]

        [ 0.35 walkway_stripe scale 0.9 ]

        [ 0.35 walkway ]

      }

      translate <0, 0, -0.45> // to line up stripes with end of walkway

    }

    rotate y*(roty + 24)

  }

  #declare roty = roty + 45;

#end





light_source {

  <6, 50, -2>

  color rgb <0.3, 0.4, 0.5> * 0.5

}

light_source {

  <-5, -50, -20>

  color rgb <0.2, 0.4, 0.6> * 0.5

}





light_source {

  <0, -500, 0>

  color rgb <0, 0.4, 1>

  fade_power 1.1

  fade_distance 50

}



/* actual end of this file */


Post a reply to this message

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