POV-Ray : Newsgroups : povray.text.scene-files : Refraction bug(?) this time Server Time
29 Jul 2024 04:17:30 EDT (-0400)
  Refraction bug(?) this time (Message 11 to 13 of 13)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Nieminen Mika
Subject: Re: Refraction bug(?) this time
Date: 4 Dec 1998 08:55:11
Message: <3667e9bf.0@news.povray.org>
=Bob <ver### [at] aolcom> wrote:
: I understood the nature of them already, that they have inside and outside. 
: Guess that's why this caught my attention so much, if other shapes in csg (or 
: not, remember my example uses none) did this it would be a disaster since many 
: csg-created objects use an inverse to get the right construction.
: A plane *is* capable of csg too, as many may know, by keeping the 
: inside/outside in mind, same goes for all the other primitives capable of csg.

  I think you haven't completely understood the plane object.
  You say: "if other shapes in csg did this it would be a disaster". Actually
all other shapes DO this. Just put a box or a sphere or whatever in the
place of the plane and make it inverse. You will get the same effect.

  Most of the objects have well defined inside and outside. Everything that
is inside the surface of a sphere, is the inside of the sphere, and
everything else is outside (this may sound very trivial, but it's important
to understans). Everything that is below the surface of a plane is the
inside of the plane, and everything else is outside.
  Now, when you apply the 'inverse' keyword, this is changed: Everything
that is inside the sphere surface becomes outside, and everything outside
the sphere surface is now inside. When you make an 'inverse' plane,
everything that is below the plane becomes outside, and everything else
is inside.
  Now, suppose you have a plane and a sphere:

plane { y,-10 }
sphere { 0,1 }

  The sphere is outside the plane because it's above the plane (the plane
normal points upwards and it's located 10 units in the negative y direction).
  If we make this:

plane { y,-10 inverse }
sphere { 0,1 }

now the sphere is _inside_ the plane, because now everything above the plane
is inside it and everything below the plane is outside it.
  This works with other primitives too:

sphere { -y*10,1 }
sphere { 0,1 }

  The second sphere is outside the first sphere, but:

sphere { -y*10,1 inverse }
sphere { 0,1 }

now the second sphere is _inside_ the first sphere. The interior of the
first sphere has became the outside part of it. This may sound confusing,
I know...

  You also don't seem to know how 'inverse' works in CSG. Well, let's see:
  Suppose we have this:

intersection
{ sphere { 0,2 }
  sphere { 0,1 inverse }
}

  Intersection means that a point is inside it if it's inside all the objects
in the intersection.
  A point can be inside the first sphere only if it's at a distance less than
2 from the origin. A point can be inside the second sphere only of it's at
a distance _greater_ than 1 from the origin (because the second sphere is
inversed). So a point is inside this intersection only if it's at a distance
less than 2 and greater than 1 from the origin.
  This means that a point that is, for example, at a distance of 3 from the
origin is outside the intersection, and thus will not be affected by the
interior of it.
  If you don't believe this, you can try it with the "problematic" primivite,
the plane. For example:

intersection
{ sphere { 0,2 }
  plane { y,0 inverse }
}

  A point is inside this intersection if it's inside the sphere and above
the plane (because the plane is inversed). This means that a point can
be inside the intersection only if it's at a distance less than 2 from
the origin and also in the positive y direction.
  So a point that is, for example, 3 units above the plane is not inside the
intersection and it will not be affected by its interior.

  So there's nothing problematic about the plane.
  There's absolutely no difference between a sphere, a box or a plane when
we are talking about CSG or inside and outside. The only difference is
that the plane is infinite, but that's just a mathematical detail, and
we shouldn't get confused by such little peculiarity.

-- 
main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
*_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp. -*/


Post a reply to this message

From: =Bob
Subject: Re: Refraction quirk(!)
Date: 5 Dec 1998 04:17:31
Message: <3668fa2b.0@news.povray.org>
Well, I tried a sphere in place of the plane and it does not affect the 
"invisible" sphere like the plane did (make a refractive appearance occur at 
that spheres surface).
If you tried this also, and got the same affect as the plane/sphere combo did, 
I must have a faulty pvengine or something here :)
Sorry you felt you had to go into that lengthy explanation of inverse, etc. 
(save for the others reading here), as I already know enough of that stuff, 
only get confused while actually making something. Check my gallery out and 
you'll see I've done plenty of csg, though I suppose I'm like many of us POV 
users and am constantly at odds with the script writing. Much trial and error 
always going on.

Well, before I posted this I decided to try a few other primitives in place of 
the plane and guess what I found...
Ones that *didn't* cause the refraction "jump" into the test sphere:
box, cylinder, cone, disc, sphere.
What *did* cause refraction at the test sphere surface:
blob (made up of 2 spheres, just so it was typical at least).
Come on now, try this stuff out for yourselves. There is something amiss.

Anyway, I say again, the other primitives I've tried do not do the same 
effect. So, suppose it is the infinite nature causing this? Or solely a plane 
thing? I'm not going to try every possible object to find out I think, I'll 
just wait to see what happens in the scenes I make and be surprised.

 ;|

Message <3667e9bf.0@news.povray.org>, Nieminen Mika  typed...
>
>  I think you haven't completely understood the plane object.
>  You say: "if other shapes in csg did this it would be a disaster". Actually
>all other shapes DO this. Just put a box or a sphere or whatever in the
>place of the plane and make it inverse. You will get the same effect.
>
>  Most of the objects have well defined inside and outside. Everything that
>is inside the surface of a sphere, is the inside of the sphere, and
>everything else is outside (this may sound very trivial, but it's important
>to understans). Everything that is below the surface of a plane is the
>inside of the plane, and everything else is outside.
>  Now, when you apply the 'inverse' keyword, this is changed: Everything
>that is inside the sphere surface becomes outside, and everything outside
>the sphere surface is now inside. When you make an 'inverse' plane,
>everything that is below the plane becomes outside, and everything else
>is inside.
---snip---
>  This means that a point that is, for example, at a distance of 3 from the
>origin is outside the intersection, and thus will not be affected by the
>interior of it.
>  If you don't believe this, you can try it with the "problematic" primivite,
>the plane. For example:
>
>intersection
>{ sphere { 0,2 }
>  plane { y,0 inverse }
>}
>
>  A point is inside this intersection if it's inside the sphere and above
>the plane (because the plane is inversed). This means that a point can
>be inside the intersection only if it's at a distance less than 2 from
>the origin and also in the positive y direction.
>  So a point that is, for example, 3 units above the plane is not inside the
>intersection and it will not be affected by its interior.
>
>  So there's nothing problematic about the plane.
>  There's absolutely no difference between a sphere, a box or a plane when
>we are talking about CSG or inside and outside. The only difference is
>that the plane is infinite, but that's just a mathematical detail, and
>we shouldn't get confused by such little peculiarity.
>

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/POVring.html
=Bob


Post a reply to this message

From: =Bob
Subject: Refraction quirk(!) test scene
Date: 5 Dec 1998 05:02:52
Message: <366904cc.0@news.povray.org>
As you may have already guessed I'm determined to show everyone this 
supposedly *normal* behaviour of refractive planes (and blobs, and ?) that 
some other primitives do not exhibit.
Please do try this test scene out and see for yourselves what I'm talking 
about. I've made it easy to test several basic primitives out.
Although, I am quite convinced (with the help of a brave few) that the plane 
is doing the correct thing according to what you would expect of it when 
inversing its properties.

// Refraction bug?
// refraction seems to jump into an external object.
// which itself does not have an ior (no csg used).
// only the plane and blob do this, others checked here do not.
// 98.92, bob hughes

// when 1 (inverse used) refraction jumps into sphere, 2 does not
#declare RB = 1;  //use 1 or 2

// 1=plane, 2=disc, 3=sphere, 4=cylinder, 5=cone, 6=box, 7=blob
#declare Primitive = 7;

// test scene below here
light_source { 0*x color rgb 1 }
camera {location <0,4,-9> look_at <0,3,0>}

// "invisible" sphere (no refraction used)
sphere {0,3
  hollow on
 pigment {rgbf<1,1,1,1>} normal {wrinkles .1}
  finish {ambient .1 diffuse .6 reflection 0 reflection_exponent 0}
 translate 3*y
}

// strange plane and blob (refraction can jump into sphere)
// these have a surface coinciding with near-center of the "invisible" sphere
#switch (Primitive)
#case (1)
plane {y,3
#break
#case (2)
disc {<0,3,0>,<0,1,0>,6
#break
#case (3)
sphere {<0,-3,0>,6
#break
#case (4)
cylinder {-3*y,3*y,6
#break
#case (5)
cone {-3*y,9,3*y,0
#break
#case (6)
box {<-3,-3,-3>,<3,3,3,>
#break
#case (7)  //single or multiple blob components have same effect
blob {threshold .33 sphere {<0,-3,0>,9,1} //sphere {<0,0,0>,4,1}
#break
#end

 hollow on
 texture {pigment {rgbf <1,1,1,.5>}
  normal {wrinkles .5 turbulence .5 triangle_wave}
   finish {phong 1 phong_size 100
//please note that reflection is turned off completely
   reflection 0 //reflection_exponent 1
   }
  }
 
 interior {ior 1.23} //some refraction for test primitives

#switch (RB)
 #case (1)
   inverse  // the culprit? or is it simply a refraction bug alone
 #break
 #case (2)
   //no inverse used
 #end
}

// base plane
plane {y,0 hollow on
 texture {pigment {rgb<.5,1,.5>}
  finish {ambient .3 diffuse .9}}
}

sky_sphere	// evening
{
  pigment
  {
    gradient y
color_map { [0.0 color rgb<0.9,0.5,0.475>] [1.0 color rgb<0.2,0.45,0.65>] }
  }
}
//END

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/POVring.html
=Bob


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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