POV-Ray : Newsgroups : povray.newusers : color modulation in textures : Re: color modulation in textures Server Time
30 Jul 2024 00:19:24 EDT (-0400)
  Re: color modulation in textures  
From: tahoma
Date: 12 May 2005 05:18:54
Message: <opsqnoh4y3x5erxw@buddie.egoof>
I got it. After some time of twaeking i come up with my first macro in  
povray :)

Here it is:

#macro pigment_from_image_map(TextureName, r,g,b)
     #local imageMap =
     function {
         pigment {
             image_map {
                 jpeg TextureName
                 transmit all 0
                 interpolate 2
             }
         }
     }
     #local R = pigment {
         function {imageMap(x,y,z).red*r}
         colour_map {
             [0 rgb 0]
             [1 rgb <3,0,0>]
         }
     }
     #local G = pigment {
         function {imageMap(x,y,z).green*g}
         colour_map {
             [0 rgb 0]
             [1 rgb <0,3,0>]
         }
     }
     #local B = pigment {
         function {imageMap(x,y,z).blue*b}
         colour_map {
             [0 rgb 0]
             [1 rgb <0,0,3>]
         }
     }
     pigment {
         uv_mapping
	  average
         pigment_map {
             [1 R]
             [1 G]
             [1 B]
         }
     }
#end


The usage is quite nice for my purpose:

#declare MY_TEXTURE =
texture {
     pigment_from_image_map("texture01.jpg",1,0,0)	
	finish {
		diffuse 1 ambient 0.2
	}	
}

But when i want to use another imageformat (e.g. png), how can i send it
as a parameter to the macro?
Does anyone from the experienced users has some advices to make it even
more flexible?

Regards,
Jan


Post a reply to this message

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