POV-Ray : Newsgroups : povray.text.scene-files : YABS source. Server Time
28 Jul 2024 16:27:53 EDT (-0400)
  YABS source. (Message 1 to 1 of 1)  
From: Michael Andrews
Subject: YABS source.
Date: 16 Mar 2000 13:13:24
Message: <38D12495.CA79BDBE@reading.ac.uk>
/*

Hi folks,

Here's the source to my blob ship image. It needs Megapov as it is, but
that's just for the blinn highlights and better radiosity - the blob
'feathering' macros should work in standard PoV.

*/

#version unofficial MegaPov 0.4;

#include "colors.inc"

// from Gilles Trans' 'maketree.inc'
#macro mAlign(P1,P2)
	#local yV1=vnormalize(P2-P1);
	#local xV1=vnormalize(vcross(yV1,z));
	#local zV1=vcross(xV1,yV1);
	matrix
<xV1.x,xV1.y,xV1.z,yV1.x,yV1.y,yV1.z,zV1.x,zV1.y,zV1.z,P1.x,P1.y,P1.z>
#end   

// Light constants.                       
#declare lightDir = vnormalize(<-1,2.1,-0>);
#declare lightLen = 1.5e6;
#declare lightCol = <1,.97,.95>;
#declare lightRad = lightLen*sin(radians(0.5));

// Camera constants.
#declare camPos = <0,-3,-25>*1.3; 
#declare camLookAt = <0,0,0>;
#declare camAngle = 30;

global_settings
{ max_trace_level 10
  assumed_gamma 1
  reflection_blur_max 2
  ambient_light 1
  ini_option "+QR"
  radiosity
  { pretrace_start 0.08
    pretrace_end   0.02
    count 50             // CHANGE range from 20 to 150
    nearest_count 5      // CHANGE range from 3 to 10
    error_bound 1        // CHANGE - range from 1 to 3 - should
correspond with pretrace_end
                         //   1 : pretrace_end = 0.02
                         //   3 : pretrace_end = 0.08
                         //   use pretrace_start = 0.08
                         // you can go lower than 1, but then you
probably will want to set
                         // pretrace_end to 0.01, which is really slow
    recursion_limit 3    // CHANGE
    
    low_error_factor .5  // leave this
    gray_threshold 0.0   // leave this
    minimum_reuse 0.015  // leave this
    brightness 1         // leave this
    
    adc_bailout 0.01/2   // CHANGE - use adc_bailout = 0.01 /
brightest_ambient_object
    normal on
  }
}

// build a sky
background { color rgb (2+<1/15,1/sqrt(15),1>)*0.1 }

sphere { 0, 100
  pigment {
    bozo
    turbulence 0.65
    octaves 6
    omega 0.7
    lambda 2
    color_map {
      [0.0 color rgb 0.65 transmit 0.5]
      [0.1 color rgb 0.75 transmit 0.5]
      [0.5 color rgbt 1]
    }
  }
  finish { ambient 0.25 diffuse 0.5 specular 0.5 }
  scale 100.75
  translate -10000*y
  hollow
  double_illuminate
}

sphere { 0, 100
  pigment {
    bozo
    turbulence 0.65
    octaves 6
    omega 0.7
    lambda 2
    color_map {
      [0.0 color rgb 0.65 transmit 0.5]
      [0.05 color rgb 0.75 transmit 0.5]
      [0.4 color rgbt 1]
    }
  }
  finish { ambient 0.25 diffuse 0.5 specular 0.5 }
  scale 100.74
  translate -10000*y
  hollow
  double_illuminate
}

sphere { 0, 100
  pigment {
    bozo
    turbulence 0.65
    octaves 6
    omega 0.7
    lambda 2
    color_map {
      [0.0 color rgb 0.75 transmit 0.5]
      [0.3 color rgbt 1]
    }
  }
  finish { ambient 0.25 diffuse 0.5 specular 0.5 }
  interior {
    media {
      emission <1/15,1/sqrt(15),1>*0.002
      absorption <1/15,1/sqrt(15),1>*0.003
      intervals 1
      samples 20,20
      method 3
    }
  }
  scale 100.73
  translate -10000*y
  hollow
  double_illuminate
}

// water to fly over
sphere { 0, 9980
   texture {
      pigment {
         color rgb <80,90,94>/255.0
      }
      finish {
         diffuse 0.2
         ambient 0.05*<80,90,94>/94
         reflection 0.4*<80,90,94>/94
         reflection_exponent 0.5
         specular 0.3
         roughness 0.001
         brilliance 0.01
         metallic 0.5
      }
      normal{
         bozo
         normal_map {
            [ 0.00 waves   0.050 translate -0.5 rotate -132 scale
1000*10000 frequency  500*10000]
            [ 0.70 ripples 0.025 translate -0.5 rotate  213 scale
1000*10000 frequency 1000*10000]
            [ 0.85 waves   0.015 translate -0.5 rotate  23  scale
1000*10000 frequency 1000*10000]
            [ 1.00 ripples 0.005 translate -0.5 rotate  73  scale
1000*10000 frequency 2000*10000]
         }
         scale 1/100
         scale 1/50
         warp { turbulence 1/5 octaves 2 lambda 5 omega 1/5 }
         warp { turbulence -1/5 octaves 2 lambda 5 omega 1/5 }
         scale 500
      }
   }
  translate -10000*y
}

camera {
	up <0, 1, 0>
	right <4/3, 0, 0>
	location  camPos
	direction <0.0, 0.0, 1>
	angle     camAngle
	look_at   camLookAt
}

light_source {
	0*x
	colour rgb lightCol
	translate lightDir*lightLen
	media_attenuation on
}

union {
	sphere { 0, 1 pigment { rgb lightCol } finish { ambient 1 diffuse 0 } }
	disc { 
		0, y, 1 
		pigment { spherical poly_wave 3 colour_map {[0 rgbt 1][1 rgb
lightCol]} } 
		finish { ambient 1 diffuse 0 } 
		scale 15 
	}
	no_shadow
	scale lightRad
	mAlign(lightLen*lightDir, camPos)
}

// 'feathered' blob macros
#macro blobSph ( C, R, S, T, Tex, DT )
  #local Sa = abs(S);
  #if (Sa >= T)
    #local D = R * sqrt(1-sqrt(T/Sa));
    #local N = 10;
    #local M = 0; #while (M < N)
      #local Sm = (M * T + (N - M) * Sa) / N;
      #local Rm = D / sqrt(1-sqrt(T/Sm));
      sphere { 0, 1, ((S < 0)? -Sm: Sm)/N scale Rm translate C #if (DT)
texture { Tex } #end }
    #local M = M + 1; #end
  #else
    sphere { 0, 1, S scale R translate C #if (DT) texture { Tex } #end }
  #end
#end
    
#macro blobCyl ( C1, C2, R, S, T, Tex, DT )
  #local Sa = abs(S);
  #if (Sa >= T)
    #local D = R * sqrt(1-sqrt(T/Sa));
    #local N = 10;
    #local M = 0; #while (M < N)
      #local Sm = (M * T + (N - M) * Sa) / N;
      #local Rm = D / sqrt(1-sqrt(T/Sm));
      cylinder { 0, (C2-C1)/Rm, 1, ((S < 0)? -Sm: Sm)/N scale Rm
translate C1 #if (DT) texture { Tex } #end }
    #local M = M + 1; #end
  #else
    cylinder { 0, (C2-C1)/R, 1, S scale R translate C1 #if (DT) texture
{ Tex } #end }
  #end
#end
    
// build the ship
#declare Scales = material { 
  texture {
    pigment { crackle solid 
      colour_map {
        [0 rgb <1,0.4,0.7>*0.4]
        [1/3 rgb <0.7,1,.4>*0.4]
        [2/3 rgb 0.4]
        [1 rgb <1,0.4,0.7>*0.4]
      } 
    } 
    finish { diffuse 0.7 ambient 0 blinn 0.3 facets 0.2 metallic 0.5 } 
    normal { crackle 0.2 slope_map {[0 <0,1>][0.1 <1,1>][0.1 <1,0>]} }
    scale 0.4 
  }
  interior { ior 10 }
}

#declare Tg = 0.5;

union {
  blob {
    threshold Tg
    blobSph ( <0,0,2>, <2,2,4>, 1, Tg, 0, false )
    blobSph ( <0,0,2>, <3,0.5,4>, 1, Tg, 0, false )
    sphere { 0, 1, -1 scale <1.25,0.75,2.5> translate <0,1,-6> }
    blobCyl ( <0,1,-2>, <0,1,-5>, <1,1,3>, 1, Tg, 0, false )
    blobCyl ( <0,0,-4>, <3,-1,-5>, <0.5,0.3,2>, 1, Tg, 0, false )
    blobCyl ( <-3,-1,-5>, <0,0,-4>, <0.5,0.3,2>, 1, Tg, 0, false )
    blobSph ( <0,0,-4>, <0.5,0.3,2>, -1, Tg, 0, false )
    blobSph ( <0,0,-6>, <1,1,3>, 1, Tg, 0, false )
    #local P1 = <0,1,4>;
    #local P2 = <0,4,4>;
    #local P3 = <0,6,2>;
    #local P4 = <0,6,-2>;
    #declare N = 7;
    #declare C = 0; #while (C < N)
      #local P1a = vrotate(P1, z*360*C/N);
      #local P2a = vrotate(P2, z*360*C/N);
      #local P3a = vrotate(P3, z*360*C/N);
      #local P4a = vrotate(P4, z*360*C/N);
      blobCyl ( P1a, P2a, <1,1,2>*0.5, 1, Tg, 0, false )
      blobCyl ( P2a, P3a, <1,1,2>*0.4, 1, Tg, 0, false )
      blobCyl ( P3a, P4a, <1,1,10>*0.3, 1, Tg, 0, false )
    #declare C = C + 1; #end
    material { Scales }
  }
  
  blob {
    threshold Tg
    blobSph ( <0,1,-5>, <1,1,2.9>, 1, Tg, 0, false )
    blobSph ( <0,0,-6>, <1,1,2.9>, 1, Tg, 0, false )
    pigment { rgb 0.7 }
    finish { ambient 0 diffuse 0.2 blinn 0.9 facets 0.05 reflection 0.2
}
    interior { ior 2.45 }
  }
  rotate <0,-20,0>
  rotate <0,0,0>
}


Post a reply to this message

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