POV-Ray : Newsgroups : povray.unofficial.patches : Another post_process idea Server Time
1 Nov 2024 23:15:58 EDT (-0400)
  Another post_process idea (Message 1 to 10 of 34)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Chris Huff
Subject: Another post_process idea
Date: 25 Apr 2000 08:20:19
Message: <chrishuff_99-BA61FD.07231725042000@news.povray.org>
How about a color_matrix? It would simply transform the colors of the 
image according to a matrix, it should make a lot of effects possible. 
This one should be easy enough to implement, I will make it my next 
project.
After that, I will try the blur/convolution/displacement matrix(still 
not sure if "convolution matrix" is the right name for it).

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: Glen Berry
Subject: Re: Another post_process idea
Date: 25 Apr 2000 08:51:53
Message: <B5QFORZjezhKLtkTgr2FzuvyFcJQ@4ax.com>
On Tue, 25 Apr 2000 07:23:17 -0500, Chris Huff
<chr### [at] yahoocom> wrote:

>How about a color_matrix? It would simply transform the colors of the 
>image according to a matrix, it should make a lot of effects possible. 

I'm not sure what you mean. Would you mind explaining more about what
you have in mind? A hypothetical example would be great.

Thanks,
Glen


( Remove the "7" from 7no### [at] ezwvcom to email me. )


Post a reply to this message

From: Chris Huff
Subject: Re: Another post_process idea
Date: 25 Apr 2000 09:08:30
Message: <chrishuff_99-D28D5E.08112825042000@news.povray.org>
In article <B5QFORZjezhKLtkTgr2FzuvyFcJQ@4ax.com>, Glen Berry 
<7no### [at] ezwvcom> wrote:

> On Tue, 25 Apr 2000 07:23:17 -0500, Chris Huff
> <chr### [at] yahoocom> wrote:
> 
> >How about a color_matrix? It would simply transform the colors of the 
> >image according to a matrix, it should make a lot of effects possible. 
> 
> I'm not sure what you mean. Would you mind explaining more about what
> you have in mind? A hypothetical example would be great.

It would be a 3*3 matrix, like this:

<AA, AB, AC,
 BA, BB, BC,
 CA, CB, CC>


resultRed   = AA*inputRed + AB*inputGreen + AC*inputBlue;
resultGreen = BA*inputRed + BB*inputGreen + BC*inputBlue;
resultBlue  = CA*inputRed + CB*inputGreen + CC*inputBlue;

This matrix would not make any change:
< 1, 0, 0,
  0, 1, 0,
  0, 0, 1>

This one would reverse the red and green components of the image:
< 0, 1, 0,
  1, 0, 0,
  0, 0, 1>

and so on.
BTW, I just got it to compile, time for testing. Oh, and another change 
I made was allowing post_process to be specified in the camera 
statement.(which is where I think it should have been in the first 
place) :-)

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: Glen Berry
Subject: Re: Another post_process idea
Date: 25 Apr 2000 21:26:03
Message: <njUGOUFjcnSZ3qj34lbk51m8BluE@4ax.com>
On Tue, 25 Apr 2000 08:11:28 -0500, Chris Huff
<chr### [at] yahoocom> wrote:

>It would be a 3*3 matrix, like this:
>
><AA, AB, AC,
> BA, BB, BC,
> CA, CB, CC>
>
>
>resultRed   = AA*inputRed + AB*inputGreen + AC*inputBlue;
>resultGreen = BA*inputRed + BB*inputGreen + BC*inputBlue;
>resultBlue  = CA*inputRed + CB*inputGreen + CC*inputBlue;

How hard would it be to do something like the following?

   resultRed = ( ((R+G+B)/3)^0.95)*1.05
   resultGreen = (R+G+B)/3
   resultBlue = ((R+G+B)/3)^0.9

This gives a fairly close approximation of Selenium Toning.

Or maybe this?

   resultRed = ((R+G+B)/3)^0.67
   resultGreen = ((R+G+B)/3)^0.85
   resultBlue = ((R+G+B)/3)

This gives a fairly close approximation of Sepia Toning

Or maybe even this?

   output_Red = 100*sin(R*pi*3)
   output_Green = 100*cos(G*pi*3)
   output_Blue = -100*sin(B*pi*3)

This gives a very wild posterization effect

Note:  For the purpose of these examples, R = the values contained in
the Red channel *after* clipping/normalizing to values between 0 and
1. "G" and "B" refer to the Green and Blue channels in a likewise
manner.

I also wanted to ask if the values you are manipulating in your matrix
are the raw unclipped values, or have they already been clipped? It
might be handy to apply a matrix or a formula to either situation, for
different reasons. The above effects are meant to work with values
constrained between 0 and 1, but if I wanted to control image
contrast, I would need to work with the raw unclipped valiues.

Later,
Glen Berry

( Remove the "7" from 7no### [at] ezwvcom to email me. )


Post a reply to this message

From: Peter Popov
Subject: Re: Another post_process idea
Date: 25 Apr 2000 21:42:14
Message: <nuhcgskdd7i2em02o2uri3ev28c51fjemm@4ax.com>
On Tue, 25 Apr 2000 07:23:17 -0500, Chris Huff
<chr### [at] yahoocom> wrote:

>After that, I will try the blur/convolution/displacement matrix(still 
>not sure if "convolution matrix" is the right name for it).

Make sure you provide the option to set the matrix size, the divisor
and the levelling value as well. This will give a lot of
possibilities.


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usanet
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Chris Huff
Subject: Re: Another post_process idea
Date: 25 Apr 2000 21:57:53
Message: <chrishuff_99-42CFE1.21005325042000@news.povray.org>
In article <njUGOUFjcnSZ3qj34lbk51m8BluE@4ax.com>, Glen Berry 
<7no### [at] ezwvcom> wrote:

> How hard would it be to do something like the following?
> ...
> This gives a fairly close approximation of Selenium Toning.
> 
> Or maybe this?
> ...
> This gives a fairly close approximation of Sepia Toning
> 
> Or maybe even this?
> ...
> This gives a very wild posterization effect

Those would be quite easy to do...but not in color_matrix. They should 
all be possible with the specialized isosurface function idea though...


> I also wanted to ask if the values you are manipulating in your matrix
> are the raw unclipped values, or have they already been clipped? It
> might be handy to apply a matrix or a formula to either situation, for
> different reasons. The above effects are meant to work with values
> constrained between 0 and 1, but if I wanted to control image
> contrast, I would need to work with the raw unclipped valiues.

They are the raw, unclipped values. Maybe a clip_colors filter would be 
useful, so different versions of each filter don't have to be made.

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: Chris Huff
Subject: Re: Another post_process idea
Date: 25 Apr 2000 22:01:09
Message: <chrishuff_99-E9884C.21040725042000@news.povray.org>
In article <nuhcgskdd7i2em02o2uri3ev28c51fjemm@4ax.com>, Peter Popov 
<pet### [at] usanet> wrote:

> Make sure you provide the option to set the matrix size,

I already have a working version. The matrix dimensions can be whatever 
you want, though odd numbers are preferred. The matrix does not have to 
be square.


> the divisor

Not implemented yet, I got sidetracked with other filters. It is 
planned, though.


> and the levelling value as well.

Levelling value? I don't understand this one...

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: Warp
Subject: Re: Another post_process idea
Date: 26 Apr 2000 05:25:57
Message: <3906b624@news.povray.org>
Perhaps something like this:

#declare ColoringFunction = function { x*.25+y*.6+z*.15 }

global_settings
{ post_process { pixel_color ColoringFunction(Red, Green, Blue) }
}

or:

#declare RedFunction = function { ... }
#declare GreenFunction = function { ... }
#declare BlueFunction = function { ... }

global_settings
{ post_process
  { pixel_color <RedFuntion(Red, Green, Blue),
                 GreenFunction(Red, Green, Blue),
                 BlueFuntion(Red, Green, Blue)>
  }
}

or something similar.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Chris Huff
Subject: Re: Another post_process idea
Date: 26 Apr 2000 08:44:03
Message: <chrishuff_99-F9EDE4.07470226042000@news.povray.org>
In article <3906b624@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>   Perhaps something like this:
> 
> #declare ColoringFunction = function { x*.25+y*.6+z*.15 }
> 
> global_settings
> { post_process { pixel_color ColoringFunction(Red, Green, Blue) }
> }
> 
> or:
> 
> #declare RedFunction = function { ... }
> #declare GreenFunction = function { ... }
> #declare BlueFunction = function { ... }
> 
> global_settings
> { post_process
>   { pixel_color <RedFuntion(Red, Green, Blue),
>                  GreenFunction(Red, Green, Blue),
>                  BlueFuntion(Red, Green, Blue)>
>   }
> }
> 
> or something similar.

What I was thinking of was something like this:
global_settings or camera {
    post_process {
        post_function < function {...red function...},
                        function {...green function...},
                        function {...blue function...} >
    }
}
And there would be additional variables:
r, g, b                   - unclipped RGB colors.
x, y, z                   - intersection point.
u, v                      - UV coordinates.
depth                     - distance to intersection point.
inorm_x, inorm_y, inorm_z - surface normal at intersection point.
pnorm_x, pnorm_y, pnorm_z - perturbed surface normal.
dir_x, dir_y, dir_z       - ray direction(if I succeed in adding it to 
the available information).


You could use this filter to do the same thing as the color_matrix 
filter, and just about anything else that doesn't require information on 
other pixels:
post_function < function {r*AA + g+AB + b*AC},
                function {r*BA + g+BB + b*BC},
                function {r*CA + g+CB + b*CC} >

Another possibility would be to implement these variables as functions 
taking two parameters(pixel coordinates), and add h and v variables for 
pixel coordinates...the functions would return the information for the 
specified pixel. This would be tremendously flexible, and would allow 
blurring filters.

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: Peter Popov
Subject: Re: Another post_process idea
Date: 26 Apr 2000 15:14:44
Message: <ur5dgsgctbpg7mva7203jsljrr70icukhu@4ax.com>
On Tue, 25 Apr 2000 21:04:07 -0500, Chris Huff
<chr### [at] yahoocom> wrote:

>Levelling value? I don't understand this one...

It's just a constant you add to the weighted sum before you divide it
by the divisor.


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usanet
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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