|
![](/i/fill.gif) |
In article <a5jn8vs8n8u2929ajl86cmjtbhsamdm4fh@4ax.com>,
ABX <abx### [at] abx art pl> wrote:
> (Are you sure you used correct math for this effect? I used weighting.)
I didn't, but I wasn't really concerned with that, since the syntax
itself is so rough.
define BasicCamera = camera {...usual camera stuff...}
function lerp(mn, mx, t) {return mn*t + mx*(1-t);}
special_camera {
function trace_pixel(x, y) {
//get the raw color of the pixel
def pixelColor = BasicCamera.trace_pixel(x, y);
//The result is a linear interpolation between the raw color
//and the background, controlled by the alpha channel.
def result = lerp(pixelColor, bkgndPigment(x/image_width,
y/image_height, 0), pixelColor.alpha);
//That calculation modified alpha, so set it back to normal
result.alpha = pixelColor.alpha;
//do I need to explain?
return result;
}
}
> That's possible and already tested with my post_process
> implementation (if you wish I can send sample image to p.b.i but its
> content seems obvious). It is possible with following script.
You seem to miss the point completely. I'm not talking about a post
process feature, isn't that obvious? This is a way to specify the camera
behavior at a very low level. That trace_pixel() function is called by
POV to trace every pixel.
> #declare f_avg=function(v1,v2,w){(1-w)*v1+w*v2}; // average/weight
Eh...this is linear interpolation, not any kind of average. A common
name seems to be "lerp", though I don't know why, I usually use
something like linInterp. Anyway, there should be a function already
defined which does this...and it is unrelated to the subject of this
thread.
> global_settings{
> post_process{
> // functions for four channels of output
> function{f_avg(f_output_red(x,y)
> ,back_Pig(x,y,0).x,f_output_alpha(x,y))}
> function{f_avg(f_output_green(x,y),back_Pig(x,y,0).y,f_output_alpha(x,y)
> )}
> function{f_avg(f_output_blue(x,y)
> ,back_Pig(x,y,0).z,f_output_alpha(x,y))}
> function{0}
> save_file "with_background.png"
> }
> }
Sorry, but yuck. This is something that really needs vector functions,
and IMO should wait until they are available because it will need to be
redesigned and rewritten when they are here.
> Please note that you have more control in this implementation than in your
> script becouse you can define differend behaviour for each channel.
Wrong. My script only handled all channels at once because that was all
that was needed. It could easily handle channels separately.
> I hope you like this new post_processing.
Sorry, I don't. Great improvement in functionality, but extreme loss in
useability and efficiency. As I said, this really, really needs vector
functions. Using n-tuples of functions makes things far more complex
than necessary, and requires recomputing things that could be done once.
your "one-pass" version calls camb_Pig() 6 times and back_Pig() 3 times
per pixel, when once each would do. It also takes three functions whcih
have only 2 characters that change, when one function of about the same
length would do.
--
Christopher James Huff <cja### [at] earthlink net>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tag povray org
http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |