POV-Ray : Newsgroups : povray.general : Adding two images via functions...? Server Time
5 Nov 2024 07:19:06 EST (-0500)
  Adding two images via functions...? (Message 1 to 7 of 7)  
From: Tim Nikias v2 0
Subject: Adding two images via functions...?
Date: 16 Jun 2003 19:36:40
Message: <3eee5488@news.povray.org>
What I'm trying to do is following:
I've got two images, one in grayscale,
the other just some image. I want to
add the grayscale to the other image, so
that white areas of the grayscale are white
in the combination, and black won't change
the colored image.

There has got to be some way to do this
and to use that function as a pattern (along
with colors and all), so that I may map the
resulting function using uv-mapping onto
two triangles which cover exactly the camera's
field of view.

Thus I want to create a method of combining
specularity-image (made by my latest macros)
with an image (which has no specularity components),
and still do it all in POV.

Any hints, code-snippets, links?


-- 
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: Tim### [at] gmxde


Post a reply to this message

From: Mark Weyer
Subject: Re: Adding two images via functions...?
Date: 17 Jun 2003 03:50:47
Message: <3EEEC8AA.60709@informatik.uni-freiburg.de>
> What I'm trying to do is following:
> I've got two images, one in grayscale,
> the other just some image. I want to
> add the grayscale to the other image, so
> that white areas of the grayscale are white
> in the combination, and black won't change
> the colored image.

Let eps be small enough. I usually use

   #declare eps = 1e4;

Apply the gray picture as a texture to a plane and add:

   pigment_map {
     [0 rgbt <0,0,0,1-eps>]
     [1 rgbt <1,1,1,1-eps>]
   }
   finish {ambient 1/eps}

There should be a way to do that without the pigment_map,
but I am unsure enough about above syntax. Hope the idea
made it through, though...


-- 
merge{#local i=-11;#while(i<11)#local
i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: Adding two images via functions...?
Date: 17 Jun 2003 06:08:44
Message: <3eeee8ac$1@news.povray.org>
I'm doing it like this now:

 #local _I=function{pigment{_ImagePigment}}
 #local _Image=texture{
  pigment{function{_I(x,y,z).x}
   color_map{[0 rgbt <1,1,1,1>][1 rgbt <1,1,1,0>]}
   poly_wave _Exponent
   }
  finish{ambient _Brightness diffuse 0}
  }

And it works fine. Thanks for the suggestion though,
even though that one didn't work, it got me to the right
place.

Regards,
Tim
-- 
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: Tim### [at] gmxde
"Mark Weyer" <wey### [at] informatikuni-freiburgde> schrieb im Newsbeitrag
news:3EE### [at] informatikuni-freiburgde...
> > What I'm trying to do is following:
> > I've got two images, one in grayscale,
> > the other just some image. I want to
> > add the grayscale to the other image, so
> > that white areas of the grayscale are white
> > in the combination, and black won't change
> > the colored image.
>
> Let eps be small enough. I usually use
>
>    #declare eps = 1e4;
>
> Apply the gray picture as a texture to a plane and add:
>
>    pigment_map {
>      [0 rgbt <0,0,0,1-eps>]
>      [1 rgbt <1,1,1,1-eps>]
>    }
>    finish {ambient 1/eps}
>
> There should be a way to do that without the pigment_map,
> but I am unsure enough about above syntax. Hope the idea
> made it through, though...
>
>
> -- 
> merge{#local i=-11;#while(i<11)#local
> i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
> pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer
>


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: Adding two images via functions...?
Date: 17 Jun 2003 07:17:03
Message: <3eeef8af$1@news.povray.org>
I'm trying to combine all three color componentes
now. So that I might take any image, and black=transparent,
white=non-transparent, and every color in between will
get transparency based on total brightness... Sort of like
a color overlay. Anyone know how to do that?

-- 
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: Tim### [at] gmxde

> I'm doing it like this now:
>
>  #local _I=function{pigment{_ImagePigment}}
>  #local _Image=texture{
>   pigment{function{_I(x,y,z).x}
>    color_map{[0 rgbt <1,1,1,1>][1 rgbt <1,1,1,0>]}
>    poly_wave _Exponent
>    }
>   finish{ambient _Brightness diffuse 0}
>   }
>
> And it works fine. Thanks for the suggestion though,
> even though that one didn't work, it got me to the right
> place.
>
> Regards,
> Tim
> -- 
> Tim Nikias v2.0
> Homepage: http://www.digitaltwilight.de/no_lights
> Email: Tim### [at] gmxde
> "Mark Weyer" <wey### [at] informatikuni-freiburgde> schrieb im Newsbeitrag
> news:3EE### [at] informatikuni-freiburgde...
> > > What I'm trying to do is following:
> > > I've got two images, one in grayscale,
> > > the other just some image. I want to
> > > add the grayscale to the other image, so
> > > that white areas of the grayscale are white
> > > in the combination, and black won't change
> > > the colored image.
> >
> > Let eps be small enough. I usually use
> >
> >    #declare eps = 1e4;
> >
> > Apply the gray picture as a texture to a plane and add:
> >
> >    pigment_map {
> >      [0 rgbt <0,0,0,1-eps>]
> >      [1 rgbt <1,1,1,1-eps>]
> >    }
> >    finish {ambient 1/eps}
> >
> > There should be a way to do that without the pigment_map,
> > but I am unsure enough about above syntax. Hope the idea
> > made it through, though...
> >
> >
> > -- 
> > merge{#local i=-11;#while(i<11)#local
> > i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
> > pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer
> >
>
>


Post a reply to this message

From: John VanSickle
Subject: Re: Adding two images via functions...?
Date: 17 Jun 2003 16:46:16
Message: <3EEF7E13.F4C7D223@hotmail.com>
Tim Nikias v2.0 wrote:
> 
> What I'm trying to do is following:
> I've got two images, one in grayscale,
> the other just some image. I want to
> add the grayscale to the other image, so
> that white areas of the grayscale are white
> in the combination, and black won't change
> the colored image.
> 
> There has got to be some way to do this
> and to use that function as a pattern (along
> with colors and all), so that I may map the
> resulting function using uv-mapping onto
> two triangles which cover exactly the camera's
> field of view.
> 
> Thus I want to create a method of combining
> specularity-image (made by my latest macros)
> with an image (which has no specularity components),
> and still do it all in POV.
> 
> Any hints, code-snippets, links?

// the grayscale
#local pigM=pigment { image_map { png "mymask.png" } }

// the overlaid picture
#local pigP=pigment { image_map { png "mypic.png" } }

// this combines them
pigment { pigment_pattern { pigM }
  pigment_map {
    [0 pigP]
    [1 pigM]
  }
}

Hope this helps,
John


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: Adding two images via functions...?
Date: 17 Jun 2003 16:55:20
Message: <3eef8038$1@news.povray.org>
Thanks! Got to try it first, but it looks like what
I want.

Personally, I'm not too sure about others, but I
find the documentation doesn't cover functions
well enough as it does all the other sections. Perhaps
someone could work on this? I'm obviously not
the guy for that though... :-)


-- 
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: Tim### [at] gmxde

> Tim Nikias v2.0 wrote:
> >
> > What I'm trying to do is following:
> > I've got two images, one in grayscale,
> > the other just some image. I want to
> > add the grayscale to the other image, so
> > that white areas of the grayscale are white
> > in the combination, and black won't change
> > the colored image.
> >
> > There has got to be some way to do this
> > and to use that function as a pattern (along
> > with colors and all), so that I may map the
> > resulting function using uv-mapping onto
> > two triangles which cover exactly the camera's
> > field of view.
> >
> > Thus I want to create a method of combining
> > specularity-image (made by my latest macros)
> > with an image (which has no specularity components),
> > and still do it all in POV.
> >
> > Any hints, code-snippets, links?
>
> // the grayscale
> #local pigM=pigment { image_map { png "mymask.png" } }
>
> // the overlaid picture
> #local pigP=pigment { image_map { png "mypic.png" } }
>
> // this combines them
> pigment { pigment_pattern { pigM }
>   pigment_map {
>     [0 pigP]
>     [1 pigM]
>   }
> }
>
> Hope this helps,
> John


Post a reply to this message

From: Mark Weyer
Subject: Re: Adding two images via functions...?
Date: 18 Jun 2003 03:26:36
Message: <3EF01480.9090402@informatik.uni-freiburg.de>
> pigment { pigment_pattern { pigM }
>   pigment_map {
>     [0 pigP]
>     [1 pigM]
>   }
> }

I thought it should be addition? So, if pigP and pigM are both at 1/2,
I would have expected an outcome of 1. This gives an outcome of 3/4.


-- 
merge{#local i=-11;#while(i<11)#local
i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer


Post a reply to this message

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