POV-Ray : Newsgroups : povray.general : Modulo in 3.7RC4? Server Time
29 Jul 2024 10:31:23 EDT (-0400)
  Modulo in 3.7RC4? (Message 1 to 2 of 2)  
From: gregjohn
Subject: Modulo in 3.7RC4?
Date: 1 Mar 2012 21:30:01
Message: <web.4f50304e36bcbdfaf7bb1fbb0@news.povray.org>
Hi. I've been using this code in a color map. In 3.6 it behaves as expected. In
3.7RC4,  all my colors are shifted to cyan, magenta, yellow, and white.  This
makes me wonder if the mod() function is behaving differently in 3.7RC4, or if
it requires a different syntax now.  Crazy hypothesis, but so are the results
compared to 3.6.



For any two vectors of length <1, I use:

rgb< mod(a.x+b.x,1),mod(a.y+b.y,1),mod(a.z+b.z,1)>


Post a reply to this message

From: clipka
Subject: Re: Modulo in 3.7RC4?
Date: 2 Mar 2012 08:33:22
Message: <4f50cc22$1@news.povray.org>
Am 02.03.2012 03:28, schrieb gregjohn:
> Hi. I've been using this code in a color map. In 3.6 it behaves as expected. In
> 3.7RC4,  all my colors are shifted to cyan, magenta, yellow, and white.  This
> makes me wonder if the mod() function is behaving differently in 3.7RC4, or if
> it requires a different syntax now.  Crazy hypothesis, but so are the results
> compared to 3.6.

The mod() function hasn't been touched since ages. But gamma handling 
has, and can cause exactly the effect you see.

> rgb<  mod(a.x+b.x,1),mod(a.y+b.y,1),mod(a.z+b.z,1)>

Instead, try this:

   srgb <mod(a.x+b.x,1),mod(a.y+b.y,1),mod(a.z+b.z,1)>

Or, if you're using this recursively, leave that line unchanged, and 
instead set the initial values of a and b like this:

   #declare a = srgb<...>;
   #declare b = srgb<...>;


Alternatively (though not recommended if you're aiming for realism) you 
can specify "global_settings { assumed_gamma srgb }".


Post a reply to this message

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