POV-Ray : Newsgroups : povray.newusers : How to combine an image map, color and transparency? : Re: How to combine an image map, color and transparency? Server Time
1 May 2024 15:45:10 EDT (-0400)
  Re: How to combine an image map, color and transparency?  
From: FlyerX
Date: 24 Nov 2014 16:33:58
Message: <5473a446$1@news.povray.org>
On 11/24/2014 10:05 AM, Dicko wrote:
> Hi all,
>
> How do I combine these three?
>
> I already found a function to combine a color and an image map:
>
> #macro pigment_multiply(p1,p2)
> #local PR1 = function {pigment{p1}}
> #local PR2 = function {pigment{p2}}
> #local PR_FRed = function (x,y,z) {PR1(x,y,z).red*PR2(x,y,z).red}
> #local PR_FGrn = function (x,y,z) {PR1(x,y,z).green*PR2(x,y,z).green}
> #local PR_FBlu = function (x,y,z) {PR1(x,y,z).blue*PR2(x,y,z).blue}
>
> average pigment_map {
>      [function{PR_FRed(x,y,z)} color_map{[0 rgb 0][1 rgb <1,0,0>*3]}]
>      [function{PR_FGrn(x,y,z)} color_map{[0 rgb 0][1 rgb <0,1,0>*3]}]
>      [function{PR_FBlu(x,y,z)} color_map{[0 rgb 0][1 rgb <0,0,1>*3]}]
> }
> #end
>
> So I use for example:
> texture {pigment {pigment_multiply(pigment {color rgb<0,1,0>}, pigment
> {image_map {jpeg "image.jpg"}})}}
>
> I tried to use a rgbf color, but that adds no transparency.
>
> How to proceed?
>
> Thanks, Dick
>
>


try this:

#macro pigment_process(p1,p2,tr)
//multiplies two pigments and sets the transparency to tr
#local PR1 = function {pigment{p1}}
#local PR2 = function {pigment{p2}}
#local PR_FRed=function (x,y,z) {PR1(x,y,z).red*PR2(x,y,z).red}
#local PR_FGrn=function (x,y,z) {PR1(x,y,z).green*PR2(x,y,z).green}
#local PR_FBlu=function (x,y,z) {PR1(x,y,z).blue*PR2(x,y,z).blue}
average pigment_map{
     [function{PR_FRed(x,y,z)} color_map{[0 rgbft <0,0,0,0,tr>][1 rgbft 
<1,0,0,0,tr/3>*3]}]
     [function{PR_FGrn(x,y,z)} color_map{[0 rgbft <0,0,0,0,tr>][1 rgbft 
<0,1,0,0,tr/3>*3]}]
     [function{PR_FBlu(x,y,z)} color_map{[0 rgbft <0,0,0,0,tr>][1 rgbft 
<0,0,1,0,tr/3>*3]}]
   }
#end


FlyerX


Post a reply to this message

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