POV-Ray : Newsgroups : povray.binaries.animations : Re: function driven postprocessing : Re: function driven postprocessing Server Time
19 Jul 2024 05:25:48 EDT (-0400)
  Re: function driven postprocessing  
From: ABX
Date: 22 Jul 2003 08:43:33
Message: <i49qhv4pp9ei33t8t92o91faga6gdct7oq@4ax.com>
On Tue, 22 Jul 2003 13:21:10 +0200, "Rune" <run### [at] runevisioncom> wrote:
> This is very impressive!

Thanks. If I remember correctly that's you who made this example, thanks.

> I haven't followed the discussion in p.u.a so I don't know so much about
> how it works.

Content of channels and other previous effects is available via predefined
functions like other channels in functions.inc. There is about 20 predefined
functions. Moreover thanks to camera_view pigment you can use channels from
other cameras to create interesting effects like transitions, overlaping,
masking.

> The old post-process feature did not support antialiasing.
> Does this new approach support it?

Yes and no. Engine requests the same number of pixels as needed for image. But
within script you can deliver antialiased content which means you can apply
any antialiasing you wish just like every other effect via functions. For
example sample we are commenting used some primitive averaging to make output
more smooth in last applied effect:

  post_process{
    #local du=1/(4*image_width);
    #local dv=1/(4*image_height);
    function{(f_pp_red  (u-du,v-dv,-1)+
              f_pp_red  (u-du,v+dv,-1)+
              f_pp_red  (u+du,v-dv,-1)+
              f_pp_red  (u+du,v+dv,-1))/4}
    function{(f_pp_green(u-du,v-dv,-1)+
              f_pp_green(u-du,v+dv,-1)+
              f_pp_green(u+du,v-dv,-1)+
              f_pp_green(u+du,v+dv,-1))/4}
    function{(f_pp_blue (u-du,v-dv,-1)+
              f_pp_blue (u-du,v+dv,-1)+
              f_pp_blue (u+du,v-dv,-1)+
              f_pp_blue (u+du,v+dv,-1))/4}
    function{0}
  }

f_pp_red, f_pp_green, and f_pp_blue are output channels from other effect and
value "-1" as third parameter says it is output of previous effect. If you
wish this looks complicated do not worry about. I made set of macros to create
functions to duplicate all effects from 'old' MegaPOV + some new like
duplicating antialiasing from engine, making simple transitions, creating
subviews.

Of course new postprocessing is slower than old one. But having all effects
written as functions in SDL makes it more flexible - you can modify them,
optimize, operate on prerendered image_maps etc. etc.

> What about heavy blurring - is it not
> very slow when done using functions?

Of course more samples means longer rendering, thought rendering time depends
what is source of applied effect. You can use output of normal rendering which
has disadventage of pixelization but is fast because it is just reading of
floats from array. But you can also use mentioned camera_view feature which
means that every sample requested cause new sended ray. In this case
postprocessing time increases. In presented example camera_view was used to
test macro with "find_edges" effect from 'old' MegaPOV. Finding edges needs
many samples so this is similiar to complexity of blurring. Here is summary
statistic from presented process:

Time For Parse/Frame:    0 hours  0 minutes   0.4 seconds (0 seconds)
Time For Parse Total:    0 hours  2 minutes  25.0 seconds (145 seconds)
Time For Trace/Frame:    0 hours  0 minutes   5.1 seconds (5 seconds)
Time For Trace Total:    0 hours 25 minutes  34.0 seconds (1534 seconds)
Time For Post./Frame:    0 hours  2 minutes  32.9 seconds (152 seconds)
Time For Post. Total:   12 hours 44 minutes  44.0 seconds (45884 seconds)
          Total Time:   13 hours 12 minutes  43.0 seconds (47563 seconds)

ABX


Post a reply to this message

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