POV-Ray : Newsgroups : povray.unofficial.patches : Another post_process idea Server Time
2 Sep 2024 14:17:03 EDT (-0400)
  Another post_process idea (Message 5 to 14 of 34)  
<<< Previous 4 Messages Goto Latest 10 Messages Next 10 Messages >>>
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

From: Chris Huff
Subject: Re: Another post_process idea
Date: 26 Apr 2000 15:41:45
Message: <chrishuff_99-35A413.14444626042000@news.povray.org>
In article <ur5dgsgctbpg7mva7203jsljrr70icukhu@4ax.com>, Peter Popov 
<pet### [at] usanet> wrote:

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

What is that supposed to do, other than just lightening or (with 
negative values) darkening the image? Maybe I misunderstood you...but it 
sounds like adding in a gray "pixel" with an intensity equal to the 
levelling value.

It is implemented anyway...the final syntax is:
camera or global_settings {
    post_process {
        blur_matrix {xDim, yDim, Divisor, Levelling, < DATA >}
    }
}

-- 
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 16:00:32
Message: <t0iegs0o3sm0ebto2qcv84npae607v7mfc@4ax.com>
On Wed, 26 Apr 2000 14:44:46 -0500, Chris Huff
<chr### [at] yahoocom> wrote:

>What is that supposed to do, other than just lightening or (with 
>negative values) darkening the image? Maybe I misunderstood you...but it 
>sounds like adding in a gray "pixel" with an intensity equal to the 
>levelling value.

Glad you implemented it. Its purpose is to control contrast while the
divisor is used to control brightness (generally speaking). It is
expecially useful if the divisor differs from the sum of the cells of
the convolution matrix. For example this:

<0,1,0,
 1,5,1,
 0,1,0>

will make a slight blur with a divisor of 9. If you lower the divisor,
the image gets brighter. Adding an offset of about 0.8 puts the
brightness back to about where it was but with a much increased
contrast. It works in the reverse direction, too, with a higher
divisor and negative offset.


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: 26 Apr 2000 16:12:16
Message: <chrishuff_99-279D90.15151626042000@news.povray.org>
In article <t0iegs0o3sm0ebto2qcv84npae607v7mfc@4ax.com>, Peter Popov 
<pet### [at] usanet> wrote:

> Glad you implemented it. Its purpose is to control contrast while the
> divisor is used to control brightness (generally speaking). It is
> expecially useful if the divisor differs from the sum of the cells of
> the convolution matrix. For example this:
> 
> <0,1,0,
>  1,5,1,
>  0,1,0>
> 
> will make a slight blur with a divisor of 9. If you lower the divisor,
> the image gets brighter. Adding an offset of about 0.8 puts the
> brightness back to about where it was but with a much increased
> contrast. It works in the reverse direction, too, with a higher
> divisor and negative offset.

Ah, I see now! I hadn't thought of using it along with the divisor... 
Thanks for the suggestion.

-- 
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: 26 Apr 2000 19:06:36
Message: <chrishuff_99-05553F.18093626042000@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?
> 
>    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.

Hmm, now that I think of it...if I add "exponent" and "multiply" 
filters...that could be probably be written using multiple filters:
post_process {
    color_matrix < 0.3, 0.3, 0.3, 
                   0.3, 0.3, 0.3,
                   0.3, 0.3, 0.3 >
    exponent < 0.95, 1, 0.9>
    multiply < 1.05, 1, 1>
}


> 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

post_process {
    color_matrix < 0.3, 0.3, 0.3, 
                   0.3, 0.3, 0.3,
                   0.3, 0.3, 0.3 >
    exponent < 0.67, 0.85, 1>
}


> 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

post_process {
    color_function < function {100*sin(r(h,v)*pi*3)},
                     function {100*cos(g(h,v)*pi*3)},
                     function {100*sin(b(h,v)*pi*3)} >
}
I don't know enough about the inner workings of isosurface functions to 
do this last one, though.

One other thing that might be possible: some kind of heiarchical linking 
of post_process filters. Instead of a simple list, you could have 
several "branches" that are combined at the end. I am not sure if I am 
up to coding this though. :-)
An example would be:
post_process {
    average {
        find_edges {...}
        find_edges {...}
        blur {...}
    }
}
This would do each filter individually, and then average their results.

-- 
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

<<< Previous 4 Messages Goto Latest 10 Messages Next 10 Messages >>>

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