POV-Ray : Newsgroups : povray.binaries.images : Creating internal image_map from function. : Creating internal image_map from function. Server Time
5 Nov 2024 20:18:19 EST (-0500)
  Creating internal image_map from function.  
From: William F Pokorny
Date: 16 Feb 2023 08:48:10
Message: <63ee341a$1@news.povray.org>
Given the recent discussions on creating height_fields from functions, I 
thought I'd mention a documented feature of POV-Ray I've not seen 
discussed on these newsgroup fora - that I recall.

It's possible to create an internal image_map from a function on the fly 
in SDL. The syntax is similar to defining a height_field (HF) with a 
function on the fly. The function (or pattern via a function) runs only 
during parsing. The rendering phase then references the internal 
image_map.

For example:

...
#declare Fn02 = function {
     pattern {
         radial sine_wave frequency 16
         translate (x+z)*0.5
         rotate x*-90
     }
}
#macro ImageMap01(_HF)
   #if (_HF=0)
     image_map { function 40, 40 { Fn02(x,y,z) }
   #else
     function 40, 40 { Fn02(x,y,z) }
   #end
   #if (_HF=0)
       map_type 0
       once
     //interpolate 2
     }
     warp { repeat x flip x }
     warp { repeat y flip y }
   #end
#end
#declare Pigment01 = pigment { ImageMap01(0) }
#declare Texture01 = texture { pigment { Pigment01 } }
#declare Box01 = box { 0,<2,2,0.1> }
#declare Obj01 = object {
     Box01
     texture { Texture01 }
     translate <-1.0,-1.0,0>
}
...

Bill P.


Post a reply to this message


Attachments:
Download 'fntointernalimage.jpg' (71 KB)

Preview of image 'fntointernalimage.jpg'
fntointernalimage.jpg


 

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