POV-Ray : Newsgroups : povray.advanced-users : image_map transparency vs. difference : Re: image_map transparency vs. difference Server Time
28 Jul 2024 22:22:13 EDT (-0400)
  Re: image_map transparency vs. difference  
From: Mike Williams
Date: 13 Oct 2003 14:23:11
Message: <MYDPoGA7xui$EwUn@econym.demon.co.uk>
Wasn't it Scott Gammans who wrote:
>I recently discovered image map alpha channel transparency and have a couple
>of questions/observations:
>
>(1) I did some comparison tests between differencing out ten holes in the
>side of my model airplane to create windows vs. using a PNG image map where
>the alpha channel holes in the map create the transparencies. I was
>expecting the image map method to be slightly faster, but it was
>consistently over 40% faster (and the gap only widened as I added more
>windows). Can anyone who is familiar with the internal workings of POV-Ray
>explain why this is so? Intuitively it would seem that using image map
>transparency "stores" the differencing calculations statically so they're
>only calculated once (when you create the image map in the first place, for
>which I used POV-Ray, btw), and at runtime all of the differencing
>calculations are unneeded; POV-Ray just wraps the image map around my
>airplane fuselage cylinder and then creates a "hole" wherever a light ray
>strikes a transparent pixel in the alpha channel of the image map... is that
>a fair approximation of what's happening?

You may find some enlightenment as to what's happening in my Holes
Tutorial <http://www.econym.demon.co.uk/holetut/>. Or by taking a close
look at the differences in the statistics that are produced when you run
the scenes.

Basically what happens is that POV can't create efficient automatic
bounding for differences, so each ray is being tested against the
fuselage and against every object that's differenced from it. So if you
have 10 windows, each ray is being tested for intersection with 11
objects. The more windows you have, the more intersection tests are
performed on each ray.

If you use the alpha channel approach, then each ray is only being
tested against the single fuselage object. The number of holes doesn't
affect the number of intersection tests.

>(2) Here's something I really don't understand: Obviously the trade-off of
>using image maps vs. differencing is that you must use fairly large image
>files to get acceptable results; otherwise, if the camera gets too close to
>the model you start to see jagged edges around the window "holes". But when
>I created a 4000x4000 version of my image map, the rendering time was almost
>*exactly* the same as when I was using a 1000x1000 PNG file. The amount of
>memory used jumped considerably, of course, but the average rendering time
>between the 1000x1000 and 4000x4000 image maps was essentially unchanged. Is
>that about right?

It takes exactly the same amount of processing power for POV to look up
the contents of point <2000,2000> in a 4000x4000 image map as it does to
look up the contents of point <500,500> in a 1000x1000 image map. As
long as you have enough free physical memory to hold the whole of the
large image in RAM the speed should be the same.

If you can derive an equation which specifies where the windows are
located, then you could use a pigment function instead of an image map.
This should give you smooth edges at any magnification. This should be
nearly as fast as using an image map unless your equation turns out to
be very complicated.

The one thing that you can't do with the alpha channel approach is to
deal with a fuselage that has thick walls. 

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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