POV-Ray : Newsgroups : povray.bugreports : gradient bug causing "noise" Server Time
22 Nov 2024 14:41:38 EST (-0500)
  gradient bug causing "noise" (Message 1 to 9 of 9)  
From: Bob Hughes
Subject: gradient bug causing "noise"
Date: 20 May 1999 08:24:46
Message: <3743F0E2.98F89786@aol.com>
//BEGIN

/*
May 20, 1999
GRADIENT BUG TEST as seen in POV-Ray for Windows 3.02 and v3.1e
mailto://inversez@aol.com?Subject=PoV-Bug
The 'gradient' is introducing noise into the pigment when aligned
with a flat surface such as the box or ends of a cylinder.
The appearence is similar to the "same surface" problem in CSG.
Also note that when rendered the first time (as when first running
POV-Ray)
that the "noise" is much less evident. It is upon subsequent renders that
it really shows up well, regardless of partial rendering or not.
*/

//Primitive to use in test [1 is sphere, 2 is box, 3 is cylinder]
#declare Shape = 3;

//Use the axis gradients or not [0 is none, 1 is x, 2 is y, 3 is z]
#declare Gradient = 2;

#switch (Shape)
#case (1)
sphere {0,1
#break
#case (2)
box {-1,1
#break
#case (3)
cylinder {-y,y,1
#break
#end
 pigment {
#switch (Gradient)
#case (1)
 	gradient x
      color_map {
 		[0 color rgbf<.35,.55,.75,.333>]
 		[1 color rgbf<.85,.95,1,.999>]
 		}
#break
#case (2)
 	gradient y
      color_map {
 		[0 color rgbf<.35,.55,.75,.333>]
 		[1 color rgbf<.85,.95,1,.999>]
 		}
#break
#case (3)
 	gradient z
      color_map {
 		[0 color rgbf<.35,.55,.75,.333>]
 		[1 color rgbf<.85,.95,1,.999>]
 		}
#break
#else
 rgbf <.8,.9,.95,.8> //non-gradient pigment
#end
 } //pigment
} //box

background {rgb <.55,.7,.85>}

light_source { <2,5,9> color rgb 1 }

camera {
  location  <3,4,-5>
  angle 33
  look_at   <0,0,0>
}

//END

//I posted this here instead of making an official bugreport since I'm
//uncertain whether this is related POV-Ray alone or not.


Post a reply to this message

From: Ron Parker
Subject: Re: gradient bug causing "noise"
Date: 20 May 1999 10:27:19
Message: <37440db7.0@news.povray.org>
On Thu, 20 May 1999 06:24:18 -0500, Bob Hughes wrote:
>The 'gradient' is introducing noise into the pigment when aligned
>with a flat surface such as the box or ends of a cylinder.
>The appearence is similar to the "same surface" problem in CSG.

I've always used the same solution, too: scale the gradient by 
1.0001 or so to push that transition past the end of the object.
This one is probably even harder to fix than the coincident 
surfaces.  It's due to numerical inaccuracies in the intersection
routines.  Why it should appear differently on subsequent renders 
is a mystery, however.


Post a reply to this message

From: Bob Hughes
Subject: Re: gradient bug causing "noise"
Date: 21 May 1999 07:22:32
Message: <374533C6.874AEFC6@aol.com>
Sorry to say, no, this isn't a fix to the problem. I had tried it, and I
should have mentioned it the first time. Used 1.01 and 1.1, neither
changed anything about it. I'm very surprised I hadn't noticed it until
now, which is one reason I suspected a problem at my computer alone.


Ron Parker wrote:
> 
> On Thu, 20 May 1999 06:24:18 -0500, Bob Hughes wrote:
> >The 'gradient' is introducing noise into the pigment when aligned
> >with a flat surface such as the box or ends of a cylinder.
> >The appearence is similar to the "same surface" problem in CSG.
> 
> I've always used the same solution, too: scale the gradient by
> 1.0001 or so to push that transition past the end of the object.
> This one is probably even harder to fix than the coincident
> surfaces.  It's due to numerical inaccuracies in the intersection
> routines.  Why it should appear differently on subsequent renders
> is a mystery, however.

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/homepage.htm
 mailto://inversez@aol.com?Subject=PoV-News


Post a reply to this message

From: Ron Parker
Subject: Re: gradient bug causing "noise"
Date: 21 May 1999 11:29:03
Message: <37456daf.0@news.povray.org>
On Fri, 21 May 1999 05:21:58 -0500, Bob Hughes wrote:
>Sorry to say, no, this isn't a fix to the problem. I had tried it, and I
>should have mentioned it the first time. Used 1.01 and 1.1, neither
>changed anything about it. I'm very surprised I hadn't noticed it until
>now, which is one reason I suspected a problem at my computer alone.

That's funny, it worked for me, though it doesn't look like what you might
have expected it to.  The ends of the cylinder turn light instead of dark.
If you're wanting dark, you might need to scale smaller instead of larger.

Note, though, that I'm talking about scaling JUST THE TEXTURE, not the
object.  The problem is that the gradient you've specified goes directly
from light to dark right at y=1 and at y=-1.  That's also where the endcaps 
of your cylinder are, so a little mathematical imprecision that gives you 
an intersection at y=.9999999 gets a light pixel, while one that gives you
an intersection at y=1.0000001 gets a dark pixel.  Of course if you scale
them both together, the problem doesn't go away, because the planes still
coincide.


Post a reply to this message

From: Bob Hughes
Subject: Re: gradient bug causing "noise"
Date: 21 May 1999 21:16:09
Message: <3745F73E.FFD5066B@aol.com>
Did you render twice? Although, for me, every time after the first render
when POV-Ray is run on a fresh start the problem occurs always from then
on.
I used a [1.01 color rgb<#,#,#>] and got exactly the same result as with a
1.0 so this is curious if you actually get a corrected gradient mapping.
The box by the way shows the x and z gradients also do this.


Ron Parker wrote:
> 
> On Fri, 21 May 1999 05:21:58 -0500, Bob Hughes wrote:
> >Sorry to say, no, this isn't a fix to the problem. I had tried it, and I
> >should have mentioned it the first time. Used 1.01 and 1.1, neither
> >changed anything about it. I'm very surprised I hadn't noticed it until
> >now, which is one reason I suspected a problem at my computer alone.
> 
> That's funny, it worked for me, though it doesn't look like what you might
> have expected it to.  The ends of the cylinder turn light instead of dark.
> If you're wanting dark, you might need to scale smaller instead of larger.
> 
> Note, though, that I'm talking about scaling JUST THE TEXTURE, not the
> object.  The problem is that the gradient you've specified goes directly
> from light to dark right at y=1 and at y=-1.  That's also where the endcaps
> of your cylinder are, so a little mathematical imprecision that gives you
> an intersection at y=.9999999 gets a light pixel, while one that gives you
> an intersection at y=1.0000001 gets a dark pixel.  Of course if you scale
> them both together, the problem doesn't go away, because the planes still
> coincide.

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/homepage.htm
 mailto://inversez@aol.com?Subject=PoV-News


Post a reply to this message

From: Ken
Subject: Re: gradient bug causing "noise"
Date: 22 May 1999 02:20:34
Message: <37463E6B.D301138C@pacbell.net>
Bob Hughes wrote:
> 
> Did you render twice? Although, for me, every time after the first render
> when POV-Ray is run on a fresh start the problem occurs always from then
> on.
> I used a [1.01 color rgb<#,#,#>] and got exactly the same result as with a
> 1.0 so this is curious if you actually get a corrected gradient mapping.
> The box by the way shows the x and z gradients also do this.

Bob,

  I went in to my doctor's office one day seeking treatment for some
pain I was experiencing. I described the symptoms to the doctor and
pointed out the the pain was severely amplified when I moved in
certain ways. My doctor responded that I should not make movements
like that anymore if it hurt me so much. I will let you draw your
own analogies from that little anecdote.

 The short term fix for your noted problem is to simply scale the
entire pigment up by 0.01 - 0.00001. My testing indicates that
this is a reliable cure and is preferable to scaling the object
by equivalent amounts which could cause dimensioning problems.

 The effect you are seeing I believe is similar to what is seen
when you have two objects with different pigments lined up
with coincident or overlapping areas. I think Ron already pointed
this out so I'll move along now and leave this to the great
programming gods in the sky to work out for themselves.


-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Peter Popov
Subject: Re: gradient bug causing "noise"
Date: 22 May 1999 04:32:46
Message: <37465c66.57744492@news.povray.org>
On Fri, 21 May 1999 19:15:58 -0500, Bob Hughes <inv### [at] aolcom>
wrote:

>Did you render twice? Although, for me, every time after the first render
>when POV-Ray is run on a fresh start the problem occurs always from then
>on.
>I used a [1.01 color rgb<#,#,#>] and got exactly the same result as with a
>1.0 so this is curious if you actually get a corrected gradient mapping.
>The box by the way shows the x and z gradients also do this.

The color map is always normalised, i.e. scaled up or down to fit in
the range [0; 1] , so this solution will not work. Nor will frequency
0.99999, I think. You have to scale the pigment, there's no other way
around this. For a unit sized object you can translate it, too.

---------
Peter Popov
ICQ: 15002700


Post a reply to this message

From: Ronald L  Parker
Subject: Re: gradient bug causing "noise"
Date: 22 May 1999 05:18:03
Message: <3747680d.101550878@news.povray.org>
On Fri, 21 May 1999 19:15:58 -0500, Bob Hughes <inv### [at] aolcom>
wrote:

>Did you render twice? Although, for me, every time after the first render
>when POV-Ray is run on a fresh start the problem occurs always from then
>on.
>I used a [1.01 color rgb<#,#,#>] and got exactly the same result as with a
>1.0 so this is curious if you actually get a corrected gradient mapping.
>The box by the way shows the x and z gradients also do this.

Ah, the problem is that you're trying to do things that the color map
isn't allowed to do.  What you need is this:

object {
  ...
  texture {... scale 1.0001}
}


Post a reply to this message

From: Bob Hughes
Subject: Re: gradient bug causing "noise"
Date: 22 May 1999 08:37:53
Message: <37469704.F399FCBB@aol.com>
Sorry all for the confusion I had. I was reading Ron's other reply as
meant to be a index value not actually a 'scale'. I understand now. What I
don't understand though (heh-heh) is what happened to the usual method of
applying that 1.001 index number into a color_map block. I never really
knew why this was ever done since I never sought to test it against the
plain old [1.0 color rgb 1]; the [1.001 color rgb 1] was used often in
POV-Ray 2.* and earlier scripts as you may well know.
Thanks again for setting me straight guys, the extra effort needed to do
so is all my fault.


"Ronald L. Parker" wrote:
> 
> On Fri, 21 May 1999 19:15:58 -0500, Bob Hughes <inv### [at] aolcom>
> wrote:
> 
> >Did you render twice? Although, for me, every time after the first render
> >when POV-Ray is run on a fresh start the problem occurs always from then
> >on.
> >I used a [1.01 color rgb<#,#,#>] and got exactly the same result as with a
> >1.0 so this is curious if you actually get a corrected gradient mapping.
> >The box by the way shows the x and z gradients also do this.
> 
> Ah, the problem is that you're trying to do things that the color map
> isn't allowed to do.  What you need is this:
> 
> object {
>   ...
>   texture {... scale 1.0001}
> }

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/homepage.htm
 mailto://inversez@aol.com?Subject=PoV-News


Post a reply to this message

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