POV-Ray : Newsgroups : povray.general : Differences in rendering 3.50c vs. 3.6.1 : Re: Differences in rendering 3.50c vs. 3.6.1 Server Time
2 Aug 2024 08:17:18 EDT (-0400)
  Re: Differences in rendering 3.50c vs. 3.6.1  
From: Mike Williams
Date: 24 Nov 2004 22:34:19
Message: <lrixGBAvJVpBFwBP@econym.demon.co.uk>
Wasn't it Jakob Hunsballe who wrote:
>Hi - some time ago i gathered some .pov files from various places (i.e. the
>web) in order to benchmark povray, after upgrading to v3.6.1 one of the
>files renders a different picture than previously.. The code (which i did
>not write) along with a picture can be found here:
>http://members.jcom.home.ne.jp/tom3d/pov43/ilpov43e.htm
>the first heave (and others) give totally different results in 3.6.1 vs.
>3.50c
>(v3.50c renders a version similar to the picture on that page, while v3.6.1
>does not)

I've had a look at the top scene on that page.

What's happening is that in 3.5 the "Wave" macro always returns the
calculated result, but in 3.6 the calculated values occasionally fail to
be returned from the macro.

The code of the macro is:

#macro Wave (Xo, Yo, Zo, To, Lo)
  #declare Yo = 40*sin(1.5*To/pi+pi*0.8+0.3*pi*Lo)/(0.3+0.1*To)*sin(0.2*
Lo+0.02*To);
  #declare Xo = 10*To+20*cos(1.5*To/pi+pi*1)/(0.3+0.1*To)-1*Yo;
  #declare Zo = 100*(Lo-2);
  #declare Lxz = sqrt(Xo*Xo*4+Zo*Zo);
  #declare Yo = Yo-Lxz*sin(asin(Lo/2/300));
#end

And it's called like this

#declare Cp = array[Tmax][Lmax][3]
#declare T = 0; #while (T<Tmax)
  #declare L = 0; #while (L<Lmax)
    #declare M = 0; #while (M<3)
      #declare Cp[T][L][M] = 0;
    #declare M = M+1; #end
    Wave (Cp[T][L][0], Cp[T][L][1], Cp[T][L][2], T+Ncase, L)
  #declare L = L+1; #end
#declare T = T+1; #end

The macro gets called 30000 times, and about 29965 of those times the
calculated values get returned into the Cp array, but on 35 of those
calls one of the calculated values doesn't get returned. The value in
the control point array is whatever the array was preloaded with (in
this case 0). So about 35 of the 30000 control points of the mesh are
incorrectly positioned, producing ugly spikes in the surface.

Changes to other parts of the scene (e.g. adding the debugging code that
I used to determine what was going on) cause the errors to appear at
different points of the surface.

I've so far failed to reproduce the effect in a minimal scene.


A dirty workround is to return the values from Wave() in simple
variables which are not reset between calls. When the macro fails to
return a calculated value, the variable retains the value calculated for
the previous point which is only slightly out of place and the resulting
errors in the surface are not noticeable.

    Wave (XX, YY, ZZ, T+Ncase, L)
    #declare Cp[T][L][0] = XX;
    #declare Cp[T][L][1] = YY;
    #declare Cp[T][L][2] = ZZ;

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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