POV-Ray : Newsgroups : povray.text.scene-files : imagemap iso fun Server Time
23 Dec 2024 11:00:59 EST (-0500)
  imagemap iso fun (Message 1 to 1 of 1)  
From: nospam
Subject: imagemap iso fun
Date: 14 Nov 2001 19:52:44
Message: <3bf3111c.5672159@localhost>
// version 3.5 only!!!  Uses isosurfaces and pigment functions!!
/* Edit the file to use the bitmap of your choice for
   "pic_to_use" and you should be ready to render.
   This renders in stereo and looks freakin cool! */

/* image map (in a sphereical map) used as a function to
   "Drive" an isosurface */

#version 3.5;
#declare rseed = seed(38518739);  // controls rotation of isosurface
#declare pic_to_use = "pipe_corridor.tga" // picture to make the
// isosurface from


#macro lazy_map(lm_filename)
  #local lz_sl = strlen(lm_filename);
  // get file type
  #local lz_ext = strlwr(substr(lm_filename, lz_sl - 2, 3))
  #if (strcmp(lz_ext, "tga") = 0)
    tga lm_filename
  #else
    #if (strcmp(lz_ext, "png") = 0)
      png lm_filename
    #else
      #if (strcmp(lz_ext, "gif") = 0)
        gif lm_filename
      #else
        #if (strcmp(lz_ext, "iff") = 0)
          iff lm_filename
        #else
          sys lm_filename
        #end
      #end
    #end
  #end
#end


#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 rrand(rlo, rhi)
  #local real_lo = min(rlo, rhi);
  #local real_hi = max(rlo, rhi);
  #local rr_result = real_lo + (rand(rseed) * (real_hi - real_lo));
  rr_result
#end


#macro rnd(nn)
  #local rnd_result = int(rand(rseed) * nn);
  rnd_result
#end


camera {
  location 0
  direction <0, 0, 3.5>
  right <(640 / 480), 0, 0>
  up <0, 1, 0>
  translate <0, 0, -13>  
}


#declare main_map = pigment {
  image_map {
    lazy_map(pic_to_use)
    map_type 1
    interpolate 2
  }
}


#declare pic_function = function {
  pigment { main_map }
}


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


#declare Sphere = function { x^2+y^2+z^2 }


#declare s_test = union {
  isosurface {
    function {
      (1 - pic_function(x, y, z).grey) * 0.4 +
      Sphere(x, y, z)
    }
    max_gradient 8
    threshold 0.9
    contained_by { sphere { 0, 0.999 } }
    no_shadow
    //pigment { color rgb 1 }
    pigment { main_map }
    finish { ambient 0.3 diffuse 0.7 }
    rnd_rotate()
  }
  sphere {
    0, 1
    pigment { color rgbt <1, 1, 1, 0.9> }
    finish { ambient 0.4 diffuse 0.5 }
    no_shadow
  }
}


object {
  s_test
  translate <-1.1, 0, 0>
}


object {
  s_test
  translate <1.1, 0, 0>
}


light_source {
  <0, 0, -3000>
  color rgb <0.4, 0.5, 0.6>
  rotate x*45
  rotate y*38
}


light_source {
  <0, 0, -3000>
  color rgb <0.6, 0.5, 0.4>
  rotate x*46
  rotate y*-43
}


/* actual end of this file */


Post a reply to this message

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