POV-Ray : Newsgroups : povray.general : Height_field help : Height_field help Server Time
9 Oct 2024 03:29:20 EDT (-0400)
  Height_field help  
From: Leroy
Date: 5 Mar 2023 11:50:00
Message: <web.6404c75bf7444c077917166bf712fc00@news.povray.org>
For all those playing with height_fields here a mac I wrote long ago to help
load the image for a height field

#macro Image(File)
 #local L=strlen(File);
 #local Out=-1;
 #local Cnt = L;
 #while (Cnt >0)
  #if(strcmp(substr(File,Cnt,1),".")=0)
   #local Out=Cnt;
   #local Cnt =0;
  #end
 #local Cnt = Cnt-1;
 #end
 #if(Out<0) #debug concat ("\nFile :: "File," :: Failed\n\n") #error "Image_Map
File bad" #end
 #local Cnt =L-Out;
 #local Bs=strlwr(substr(File,Out+1,Cnt)) //#debug concat("\n__",Bs,"___\n")

 #if(Bs="tga") tga File #end
 #if(Bs="bmp") bmp File #end
 #if(Bs="pgm") pgm File #end
 #if(Bs="png") png File #end
 #if(Bs="ppm") ppm File #end
 #if(Bs="jpg") jpeg File  #end
 #if(Bs="exr") exr File #end
 #if(Bs="hdr") hdr File #end
 #if(Bs="gif") gif File #end
 #if(Bs="iff") iff File #end
 #if(Bs="tif") tiff File  #end
#declare Image_Type=Bs;// Type string that can be used else where
#end

How to use:

#declare FileStr="Image.tga"

height_field{Image(Filestr} ...
        or
#declare PigFnc=function{pigment{image_map{Image(FileStr)}}}
height_field {function 400,400{ PigFnc(x,y) }

Hope this can be some help.

I have tested all the files except the "iff" type. I have nothing that can
produce them. Does any one use 'iff' any more?
The 'gif' & 'tif' files where hard to find in my files as I rarely use them any
more. All the rest where made with POV.

Have Fun!


Post a reply to this message

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