POV-Ray : Newsgroups : povray.general : Slope buggerliness Server Time
17 Nov 2024 17:18:29 EST (-0500)
  Slope buggerliness (Message 1 to 9 of 9)  
From: Meow Cat
Subject: Slope buggerliness
Date: 12 Feb 2003 02:53:24
Message: <3e49fd74@news.povray.org>
Someone verify this for me?

Stats:
WinPOV 3.5
Win2000 Pro SP3
Athlon XP 1800+

Transparent colors of any sort (filter/transmit) seem nonfunctional with the
slope pattern. Fully opaque objects work fine, though.

The opaque comparison objects (using textures 9 and 10) seem identical at
least to me, so I think I got the normal calculation function about right.

Strictly judging it doesn't make much sense to evaluate transparency by
surface normal, but it's quite handy for creating a dust layer pigment.
'sphere_tex_2' is clearly erroneous in any case.

This scene code demonstrates the bug in several variants:

// ----------------------------------------

#version 3.5;

global_settings {
  assumed_gamma 1.0
}

// ----------------------------------------

camera {
  location  <0.0, 0.0, -10.0
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0]
      [0.7 rgb <0.0,0.1,0.8]
    }
  }
}

light_source {
  <0, 0, 0            // light's position (translated below)
  color rgb <1, 1, 1  // light's color
  translate <-30, 30, -30
  shadowless
}

// ----------------------------------------

plane {
  -z, -1
  pigment

    hexagon
    color rgb 1.0
    color rgb 0.5
    color rgb 0.1
    scale 1.5
    rotate 90*x
  }
}

// ----------------------------------------

#declare F1 = finish { diffuse 0 ambient 1 reflection 0 specular 0 }
#declare F2 = finish { diffuse 1 ambient 0 reflection 0 specular 0 }
#declare F3 = finish { phong 0.4 }

#declare X1F = pigment { color rgbf < 1, 1, 0, 0  }
#declare X2F = pigment { color rgbf < 0, 0, 1, 1  }
#declare X1T = pigment { color rgbt < 1, 1, 0, 0  }
#declare X2T = pigment { color rgbt < 0, 0, 1, 1  }
#declare X1O = pigment { color rgb  < 1, 1, 0  }
#declare X2O = pigment { color rgb  < 0, 0, 1  }

#declare S1 =  pigment { slope y                   pigment_map { [ 0 X1F ] 1
X2F ] }}
#declare S2 =  pigment { slope y                   pigment_map { [ 0 X1T ] 1
X2T ] }}
#declare S3 =  pigment { slope y                   pigment_map { [ 0 X1O ] 1
X2O ] }}
#declare G1 =  pigment { function {0.5+asin(y)/pi} pigment_map { [ 0 X1F ] 1
X2F ] }}
#declare G2 =  pigment { function {0.5+asin(y)/pi} pigment_map { [ 0 X1T ] 1
X2T ] }}
#declare G3 =  pigment { function {0.5+asin(y)/pi} pigment_map { [ 0 X1O ] 1
X2O ] }}

#declare sphere_tex_1 = texture { pigment { S1 } finish { F1 }}
#declare sphere_tex_2 = texture { pigment { S2 } finish { F1 }}
#declare sphere_tex_3 = texture { pigment { S1 } finish { F2 }}
#declare sphere_tex_4 = texture { pigment { S2 } finish { F2 }}
#declare sphere_tex_9 = texture { pigment { S3 } finish { F3 }}

#declare sphere_tex_5 = texture { pigment { G1 } finish { F1 }}
#declare sphere_tex_6 = texture { pigment { G2 } finish { F1 }}
#declare sphere_tex_7 = texture { pigment { G1 } finish { F2 }}
#declare sphere_tex_8 = texture { pigment { G2 } finish { F2 }}
#declare sphere_tex_10 = texture { pigment { G3 } finish { F3 }}


// Left side group: 'Buggy' slope
union {
    sphere {0, 1 texture { sphere_tex_1 } translate  x+y}
    sphere {0, 1 texture { sphere_tex_2 } translate -x+y}
    sphere {0, 1 texture { sphere_tex_3 } translate  x-y}
    sphere {0, 1 texture { sphere_tex_4 } translate -x-y}
    sphere {0, 1 texture { sphere_tex_9 } translate 3*y}

    translate -2.2*x-y
}

// Right side group: 'correct' function
union {
    sphere {0, 1 texture { sphere_tex_5 } translate  x+y}
    sphere {0, 1 texture { sphere_tex_6 } translate -x+y}
    sphere {0, 1 texture { sphere_tex_7 } translate  x-y}
    sphere {0, 1 texture { sphere_tex_8 } translate -x-y}
    sphere {0, 1 texture { sphere_tex_10 } translate 3*y}

    translate 2.2*x-y
}


Post a reply to this message

From: hughes, b 
Subject: Re: Slope buggerliness
Date: 12 Feb 2003 12:47:26
Message: <3e4a88ae@news.povray.org>
Interesting. Yes, I see that if the X2T color has lower transmit it becomes
more like the comparison sphere. It looks the same at transmit 0, almost
okay still at 0.5, and then more yellow is introduced as that is raised
toward 1.

I have no idea what should be expected really though, so "okay" and
correctness is in question here, just that you seem to have found some kind
of discrepency. I'm reposting your script here because it was unparsable
before due to missing syntax, namely > and [.

// ----------------------------------------

#version 3.5;

global_settings {
  assumed_gamma 1.0
}

// ----------------------------------------

camera {
  location  <0.0, 0.0, -10.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
  shadowless
}

// ----------------------------------------

plane {
  -z, -1
  pigment {
    hexagon
    color rgb 1.0
    color rgb 0.5
    color rgb 0.1
    scale 1.5
    rotate 90*x
  }
}

// ----------------------------------------

#declare F1 = finish { diffuse 0 ambient 1 reflection 0 specular 0 }
#declare F2 = finish { diffuse 1 ambient 0 reflection 0 specular 0 }
#declare F3 = finish { phong 0.4 }

#declare X1F = pigment { color rgbf < 1, 1, 0, 0 > }
#declare X2F = pigment { color rgbf < 0, 0, 1, 1 > }
#declare X1T = pigment { color rgbt < 1, 1, 0, 0 > }

 // change transmit value of color below to see changes
#declare X2T = pigment { color rgbt < 0, 0, 1, 1 > }

#declare X1O = pigment { color rgb  < 1, 1, 0 > }
#declare X2O = pigment { color rgb  < 0, 0, 1 > }

#declare S1 =  pigment { slope y  pigment_map { [ 0 X1F ] [1 X2F ] }}
#declare S2 =  pigment { slope y  pigment_map { [ 0 X1T ] [1 X2T ] }}
#declare S3 =  pigment { slope y  pigment_map { [ 0 X1O ] [1 X2O ] }}
#declare G1 =  pigment { function {0.5+asin(y)/pi}
pigment_map { [ 0 X1F ] [1 X2F ] }}
#declare G2 =  pigment { function {0.5+asin(y)/pi}
pigment_map { [ 0 X1T ] [1 X2T ] }}
#declare G3 =  pigment { function {0.5+asin(y)/pi}
pigment_map { [ 0 X1O ] [1 X2O ] }}

#declare sphere_tex_1 = texture { pigment { S1 } finish { F1 }}
#declare sphere_tex_2 = texture { pigment { S2 } finish { F1 }} /* */
#declare sphere_tex_3 = texture { pigment { S1 } finish { F2 }}
#declare sphere_tex_4 = texture { pigment { S2 } finish { F2 }}
#declare sphere_tex_9 = texture { pigment { S3 } finish { F3 }}

#declare sphere_tex_5 = texture { pigment { G1 } finish { F1 }}
#declare sphere_tex_6 = texture { pigment { G2 } finish { F1 }}
#declare sphere_tex_7 = texture { pigment { G1 } finish { F2 }}
#declare sphere_tex_8 = texture { pigment { G2 } finish { F2 }}
#declare sphere_tex_10 = texture { pigment { G3 } finish { F3 }}

// Left side group: 'Buggy' slope
union {
    sphere {0, 1 texture { sphere_tex_1 } translate  x+y}
    sphere {0, 1 texture { sphere_tex_2 } translate -x+y} // one to watch
    sphere {0, 1 texture { sphere_tex_3 } translate  x-y}
    sphere {0, 1 texture { sphere_tex_4 } translate -x-y}
    sphere {0, 1 texture { sphere_tex_9 } translate 3*y}

    translate -2.2*x-y
}

// Right side group: 'correct' function
union {
    sphere {0, 1 texture { sphere_tex_5 } translate  x+y}
    sphere {0, 1 texture { sphere_tex_6 } translate -x+y}
    sphere {0, 1 texture { sphere_tex_7 } translate  x-y}
    sphere {0, 1 texture { sphere_tex_8 } translate -x-y}
    sphere {0, 1 texture { sphere_tex_10 } translate 3*y}

    translate 2.2*x-y
}


Post a reply to this message

From: Hans-Detlev Fink
Subject: Re: Slope buggerliness
Date: 14 Feb 2003 08:10:47
Message: <3E4CEABA.6090106@pecos.no.spam.de>
Doesn't change the basic problem, but shouldn't
     0.5+asin(y)/pi
rather be
     0.5*(1+asin(y)/pi) ?

-Hans-

Meow Cat wrote:
> Someone verify this for me?
> 
> Stats:
> WinPOV 3.5
> Win2000 Pro SP3
> Athlon XP 1800+
> 
> Transparent colors of any sort (filter/transmit) seem nonfunctional with the
> slope pattern. Fully opaque objects work fine, though.
> 
> The opaque comparison objects (using textures 9 and 10) seem identical at
> least to me, so I think I got the normal calculation function about right.
> 
> Strictly judging it doesn't make much sense to evaluate transparency by
> surface normal, but it's quite handy for creating a dust layer pigment.
> 'sphere_tex_2' is clearly erroneous in any case.
> 
> This scene code demonstrates the bug in several variants:
> 
> // ----------------------------------------
> 
> #version 3.5;
> 
> global_settings {
>   assumed_gamma 1.0
> }
> 
> // ----------------------------------------
> 
> camera {
>   location  <0.0, 0.0, -10.0
>   direction 1.5*z
>   right     x*image_width/image_height
>   look_at   <0.0, 0.0,  0.0
> }
> 
> sky_sphere {
>   pigment {
>     gradient y
>     color_map {
>       [0.0 rgb <0.6,0.7,1.0]
>       [0.7 rgb <0.0,0.1,0.8]
>     }
>   }
> }
> 
> light_source {
>   <0, 0, 0            // light's position (translated below)
>   color rgb <1, 1, 1  // light's color
>   translate <-30, 30, -30
>   shadowless
> }
> 
> // ----------------------------------------
> 
> plane {
>   -z, -1
>   pigment
> 
>     hexagon
>     color rgb 1.0
>     color rgb 0.5
>     color rgb 0.1
>     scale 1.5
>     rotate 90*x
>   }
> }
> 
> // ----------------------------------------
> 
> #declare F1 = finish { diffuse 0 ambient 1 reflection 0 specular 0 }
> #declare F2 = finish { diffuse 1 ambient 0 reflection 0 specular 0 }
> #declare F3 = finish { phong 0.4 }
> 
> #declare X1F = pigment { color rgbf < 1, 1, 0, 0  }
> #declare X2F = pigment { color rgbf < 0, 0, 1, 1  }
> #declare X1T = pigment { color rgbt < 1, 1, 0, 0  }
> #declare X2T = pigment { color rgbt < 0, 0, 1, 1  }
> #declare X1O = pigment { color rgb  < 1, 1, 0  }
> #declare X2O = pigment { color rgb  < 0, 0, 1  }
> 
> #declare S1 =  pigment { slope y                   pigment_map { [ 0 X1F ] 1
> X2F ] }}
> #declare S2 =  pigment { slope y                   pigment_map { [ 0 X1T ] 1
> X2T ] }}
> #declare S3 =  pigment { slope y                   pigment_map { [ 0 X1O ] 1
> X2O ] }}
> #declare G1 =  pigment { function {0.5+asin(y)/pi} pigment_map { [ 0 X1F ] 1
> X2F ] }}
> #declare G2 =  pigment { function {0.5+asin(y)/pi} pigment_map { [ 0 X1T ] 1
> X2T ] }}
> #declare G3 =  pigment { function {0.5+asin(y)/pi} pigment_map { [ 0 X1O ] 1
> X2O ] }}
> 
> #declare sphere_tex_1 = texture { pigment { S1 } finish { F1 }}
> #declare sphere_tex_2 = texture { pigment { S2 } finish { F1 }}
> #declare sphere_tex_3 = texture { pigment { S1 } finish { F2 }}
> #declare sphere_tex_4 = texture { pigment { S2 } finish { F2 }}
> #declare sphere_tex_9 = texture { pigment { S3 } finish { F3 }}
> 
> #declare sphere_tex_5 = texture { pigment { G1 } finish { F1 }}
> #declare sphere_tex_6 = texture { pigment { G2 } finish { F1 }}
> #declare sphere_tex_7 = texture { pigment { G1 } finish { F2 }}
> #declare sphere_tex_8 = texture { pigment { G2 } finish { F2 }}
> #declare sphere_tex_10 = texture { pigment { G3 } finish { F3 }}
> 
> 
> // Left side group: 'Buggy' slope
> union {
>     sphere {0, 1 texture { sphere_tex_1 } translate  x+y}
>     sphere {0, 1 texture { sphere_tex_2 } translate -x+y}
>     sphere {0, 1 texture { sphere_tex_3 } translate  x-y}
>     sphere {0, 1 texture { sphere_tex_4 } translate -x-y}
>     sphere {0, 1 texture { sphere_tex_9 } translate 3*y}
> 
>     translate -2.2*x-y
> }
> 
> // Right side group: 'correct' function
> union {
>     sphere {0, 1 texture { sphere_tex_5 } translate  x+y}
>     sphere {0, 1 texture { sphere_tex_6 } translate -x+y}
>     sphere {0, 1 texture { sphere_tex_7 } translate  x-y}
>     sphere {0, 1 texture { sphere_tex_8 } translate -x-y}
>     sphere {0, 1 texture { sphere_tex_10 } translate 3*y}
> 
>     translate 2.2*x-y
> }
> 
> 
> 
> 
> 
>


Post a reply to this message

From: Meow Cat
Subject: Re: Slope buggerliness
Date: 14 Feb 2003 17:02:17
Message: <3e4d6769$1@news.povray.org>
"Hans-Detlev Fink" <mas### [at] pecosnospamde> wrote in message
news:3E4### [at] pecosnospamde...
> Doesn't change the basic problem, but shouldn't
>      0.5+asin(y)/pi
> rather be
>      0.5*(1+asin(y)/pi) ?
>
> -Hans-
>

asin did give values in the range [-pi/2, pi/2] the last time I checked...

0.5*(1+(pi/2)/pi) is about 0.75 while 0.5 + (pi/2)/pi is about 1.0

Well, we all make mistakes. In some cases it's half of the fun!

-- MeowCat


Post a reply to this message

From: Christopher James Huff
Subject: Re: Slope buggerliness
Date: 15 Feb 2003 23:57:13
Message: <cjameshuff-6D3F23.23561115022003@netplex.aussie.org>
In article <3e49fd74@news.povray.org>, "Meow Cat" <wyr### [at] hotmailcom> 
wrote:

> Transparent colors of any sort (filter/transmit) seem nonfunctional with the
> slope pattern. Fully opaque objects work fine, though.

I don't have time to look at this, but slope is just a pattern, entirely 
separate from the transparency code. It shouldn't be possible for it to 
be buggy in the way you describe.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Meow Cat
Subject: Re: Slope buggerliness
Date: 16 Feb 2003 06:32:47
Message: <3e4f76df@news.povray.org>
"Christopher James Huff" <cja### [at] earthlinknet> wrote in message
news:cja### [at] netplexaussieorg...
> In article <3e49fd74@news.povray.org>, "Meow Cat" <wyr### [at] hotmailcom>
> wrote:
>
> > Transparent colors of any sort (filter/transmit) seem nonfunctional with
the
> > slope pattern. Fully opaque objects work fine, though.
>
> I don't have time to look at this, but slope is just a pattern, entirely
> separate from the transparency code. It shouldn't be possible for it to
> be buggy in the way you describe.
>

Indeed so! However, when it comes to software bugs, I have found that
nothing is impossible, with the potential exception of software that works
perfectly. I suppose I should have a look at the code myself to find out
what this critter is doing in there.

Incidentally, it seems that slope does not work sensibly in "function
 pigment { ... }}" type thing, which is not surprising per se, but it would
be nice to have it checked and reported as error. Although this in turn
would break the pigment-function equivalency, which would not be nice
either.

BTW, I posted a picture demonstrating this bug to p.b.i, have a look at your
leisure.

-- MeowCat


Post a reply to this message

From: Christopher James Huff
Subject: Re: Slope buggerliness
Date: 16 Feb 2003 11:28:30
Message: <cjameshuff-D45F99.11271016022003@netplex.aussie.org>
In article <3e4f76df@news.povray.org>, "Meow Cat" <wyr### [at] hotmailcom> 
wrote:

> BTW, I posted a picture demonstrating this bug to p.b.i, have a look at your
> leisure.

Ah...it looks like confusion on your part, not a bug. When the sphere is 
transparent, you are seeing its interior surface, which has a different 
slope because its normal points in the opposite direction. I'm guessing 
your function doesn't take this into account, I don't see how you could 
do it with current functions. Try clipping a sphere in half with a plane 
and compare its inside surface with the outside.
You could probably use interior_texture to fix this.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Meow Cat
Subject: Re: Slope buggerliness
Date: 16 Feb 2003 12:06:13
Message: <3e4fc505@news.povray.org>
Duh!

'interior_texture' did it perfectly. This sure shows that the last povray I
used before last week was a patched 3.1g a few years back... Otherwise I
would've come across this feature long time ago.

Thanks aplenty!

-- MeowCat

"Christopher James Huff" <cja### [at] earthlinknet> wrote in message
news:cja### [at] netplexaussieorg...
> In article <3e4f76df@news.povray.org>, "Meow Cat" <wyr### [at] hotmailcom>
> wrote:
>
> > BTW, I posted a picture demonstrating this bug to p.b.i, have a look at
your
> > leisure.
>
> Ah...it looks like confusion on your part, not a bug. When the sphere is
> transparent, you are seeing its interior surface, which has a different
> slope because its normal points in the opposite direction. I'm guessing
> your function doesn't take this into account, I don't see how you could
> do it with current functions. Try clipping a sphere in half with a plane
> and compare its inside surface with the outside.
> You could probably use interior_texture to fix this.
>
> --
> Christopher James Huff <cja### [at] earthlinknet>
> http://home.earthlink.net/~cjameshuff/
> POV-Ray TAG: chr### [at] tagpovrayorg
> http://tag.povray.org/


Post a reply to this message

From: Hans-Detlev Fink
Subject: Re: Slope buggerliness
Date: 18 Feb 2003 11:30:38
Message: <3E525FD0.4050102@pecos.no.spam.de>
Shame on me. I found it the same evening when looking
into the slope code (that uses basically your equation).
I hardly dare to confess part of it was written by myself.
Shame on me!!!

-Hans-

Meow Cat wrote:
> "Hans-Detlev Fink" <mas### [at] pecosnospamde> wrote in message
> news:3E4### [at] pecosnospamde...
> 
>>Doesn't change the basic problem, but shouldn't
>>     0.5+asin(y)/pi
>>rather be
>>     0.5*(1+asin(y)/pi) ?
>>
>>-Hans-
>>
> 
> 
> asin did give values in the range [-pi/2, pi/2] the last time I checked...
> 
> 0.5*(1+(pi/2)/pi) is about 0.75 while 0.5 + (pi/2)/pi is about 1.0
> 
> Well, we all make mistakes. In some cases it's half of the fun!
> 
> -- MeowCat
> 
> 
>


Post a reply to this message

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