POV-Ray : Newsgroups : povray.text.scene-files : WorldMachine color-maps into POV Server Time
1 Nov 2024 03:15:13 EDT (-0400)
  WorldMachine color-maps into POV (Message 1 to 1 of 1)  
From: Hugo
Subject: WorldMachine color-maps into POV
Date: 7 Aug 2002 07:14:33
Message: <3d510119$1@news.povray.org>
// Read color maps from "World Machine" to POV-Ray 3.5
// by Hugo Asmussen

// ---------------------
// Please specify the path to your "World Machine" directory
// (POV-Ray may ask you to grant access to that directory.)
#local Path="f:\\programmer\\worldmachine\\";

// Choose color map (from 0 to 1)
#local map_pos=0.5;

// Sample precision (default is 64, you may go up to 255)
#local step=1/64;
// ---------------------

// Declare functions to read a map
#local Input_Maps=pigment { image_map { concat(Path,"colors.tga") once } };
#local f_pigm=function { pigment { Input_Maps } };
#local f_red=function (xpos,ypos) { f_pigm(xpos,ypos,0).red };
#local f_green=function (xpos,ypos) { f_pigm(xpos,ypos,0).green };
#local f_blue=function (xpos,ypos) { f_pigm(xpos,ypos,0).blue };

// Read color values into a pigment_map
#local cnt=0;
#declare Output_Map=pigment { gradient x
 pigment_map {
  #while (cnt!=1)
   [ cnt rgb <f_red(cnt,map_pos), f_green(cnt,map_pos),
f_blue(cnt,map_pos)> ]
   #local cnt=cnt+step;
  #end
 }
};

// Preview
camera { orthographic location -3.5*z look_at 0 }
#default { finish { ambient 1 diffuse 0 } }

box { <-2,1,0>,<0,-1,0> pigment { Input_Maps scale 2 translate <-2,-1,0> } }
box { <0,1,0>, <2,-1,0> pigment { Output_Map scale 2 } }

// End


Post a reply to this message

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