POV-Ray : Newsgroups : povray.binaries.images : Using "transmit all" with an image map : Re: Using "transmit all" with an image map Server Time
12 Jul 2025 22:27:05 EDT (-0400)
  Re: Using "transmit all" with an image map  
From: Kenneth
Date: 9 Jan 2023 17:45:00
Message: <web.63bc9767eaa53b9c2eadabda6e066e29@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
>
> You can use a pigment function to get control over the transmit value:
>
[snip]
> #local FR = function {ImageFunction(x,y,z).red}
> #local FG = function {ImageFunction(x,y,z).green }
> #local FB = function {ImageFunction(x,y,z).blue }
> #local FT = function {1 - (1 - FADE_STRENGTH) * (1-ImageFunction(x,y,z).transmit) }
>
> #local FadePigment = pigment { average pigment_map
> {
>     [function{FR(x,y,z)} color_map{[0 rgb 0][1 rgbft 4*<1,0,0,0,0>]}]
>     [function{FG(x,y,z)} color_map{[0 rgb 0][1 rgbft 4*<0,1,0,0,0>]}]
>     [function{FB(x,y,z)} color_map{[0 rgb 0][1 rgbft 4*<0,0,1,0,0>]}]
>     [function{FT(x,y,z)} color_map{[0 rgb 0][1 rgbft 4*<0,0,0,0,1>]}]
> }
....

Yes indeed, that does also work-- at least in v3.8.0 beta 1, and with ALL of the
various kinds of 24-bit and 32-bit images! Good news.

I set my own functions up a bit differently, but the results are the same:

#declare TEMP_IMG =
pigment{
   image_map{
        jpeg "MY_IMAGE.jpg" // or .png
        once
        interpolate 2
        // no 'transmit all' here
            }
}

#declare IMG_FUNCTION =
function{pigment{TEMP_IMG}}

#declare FINAL_IMG =
pigment{
     average
     pigment_map{
[1 function{IMG_FUNCTION(x,y,z).red} color_map {[0,rgb 0][1,rgb <1,0,0>]}
[1 function{IMG_FUNCTION(x,y,z).green} color_map {[0,rgb 0][1,rgb <0,1,0>]}]
[1 function{IMG_FUNCTION(x,y,z).blue} color_map {[0,rgb 0][1,rgb <0,0,1>]}]
[1 function{IMG_FUNCTION(x,y,z).transmit}
               color_map {[0, transmit 0][1,transmit 4]}]
                }
       }

Then, to vary the transparency, I adjust the 'transmit' channel's FIRST
color-map value between 0 and 4. Like,
             color_map {[0, transmit 4*clock][1,transmit 4]}


[ I personally prefer the rgb colors to be 'weights' of 1 instead of 4-- except
for 'transmit'-- then later use finish{ambient 4 emission 0 diffuse 0}  In the
past, I have noticed a slight change in color contrast(?) when I give the
function's color_maps a large value like 4. But that may have been a quirk in
how I used the final pigment, so I can't say yes or no absolutely. In other
words, does a value larger than 1.0 cause any 'clipping' in the functions?]


Post a reply to this message

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