POV-Ray : Newsgroups : povray.newusers : Uneven Scaling on the Y-Axis : Re: Uneven Scaling on the Y-Axis Server Time
29 Jul 2024 16:25:13 EDT (-0400)
  Re: Uneven Scaling on the Y-Axis  
From: Mike Williams
Date: 31 Jul 2005 14:37:02
Message: <Sgan3HA6SH7CFwah@econym.demon.co.uk>
Wasn't it Christoph Hormann who wrote:
>Mike Williams wrote:
>> 
>> It is, however, quite easy in POV to perform non-linear transformations
>> on isosurfaces. The original poster wants to perform the non-linear
>> transformation on a sphere, so there's no problem creating an isosurface
>> to apply the non-linear transformation to.
>> 
>> 
>> #declare  Sphere = function {x*x + y*y + z*z - 1}
>> 
>> isosurface {
>>   function { Sphere(x,y*(2.5-y*0.8),z) }
>>   max_gradient 4
>>   contained_by{sphere{0,1}}
>>   pigment {rgb 1}
>> }
>> 
>> Adjust the "2.5" to change the overall vertical scale.
>> Adjust the "0.8" to change how much the top differs from the bottom.
>> 
>
>Although it will be quite a bit faster if you use the internal function 
>f_sphere().

That gives a speed increase of about 6%. (It's hard to be exact because
it's highly dependent on the values of max_gradient, which are not the
same in the two cases. The max_gradient values suggested by POV vary
slightly depending on the exact details of the scene)

>  Using a minimum size box container could also be more 
>efficient.

As it happens, that doesn't give any speed improvement at all, and
actually makes it run slower if you don't adjust the max_gradient to the
lower value that POV suggests when using the box container.

But actually, that tells us that we can get away with this lower value
of max_gradient when using a spherical container, because the highest
gradient that POV finds inside the sphere must be well outside the
surface. That gives a speed increase of about 13%.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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