POV-Ray : Newsgroups : povray.newusers : Non-touching objects seem to be touching Server Time
27 Dec 2024 11:07:51 EST (-0500)
  Non-touching objects seem to be touching (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Nicki
Subject: Non-touching objects seem to be touching
Date: 10 Feb 2017 09:10:00
Message: <web.589dc9a46d40fb125e1b0d740@news.povray.org>
I want to visualize opaque spheres inside a transparent spherocylinder (a
cylinder with hemispherical caps at the ends).
When I do so I get weird red spots on the spheres even though they should not be
touching the transparent sphere. I have to make the spheres significantly
smaller then the outer transparent spherocylinder so that this problem
disappears.
In the following I show you three scene-files and the corresponding images that
show this problem.
I would be happy to hear suggestions on how to get rid of this problem.

EXHIBITION 1:
http://imgur.com/KnerkoJ

#include "colors.inc"
 background { color White }
 camera
 { location <0.005, 0.01, 0.015>
   look_at <0.0, 0.0, 0.0> }
 light_source { <-0.01, 0.0, 0.2> color White}
 light_source { <0.01, 0.0, 0.2> color White}
cylinder {< -0.0052500000, 0.0000000000, 0.0000000000 >, < 0.0052500000,
0.0000000000, 0.0000000000 >, 0.0015000000 texture {pigment {color Red transmit
0.5} finish { phong 1 }}}
intersection{ sphere {<0.00525, 0.0, 0.0>, 0.0015}
       box {<0.00525,-0.002,-0.002>,<0.007,0.002,0.002>} texture {pigment {color
Red transmit 0.5} finish { phong 1 }} }
sphere {< -0.0052500000, 0.0000000000, 0.0000000000 >, 0.00149 texture {pigment
{color Yellow}  finish { phong 1 }}}
sphere {< 0.0052500000, 0.0000000000, 0.0000000000 >, 0.00149 texture {pigment
{color Yellow}  finish { phong 1 }}}
sphere {< -0.0026250000, 0.0000000000, 0.0000000000 >, 0.00149 texture {pigment
{color Yellow}  finish { phong 1 }}}
sphere {< 0.0000000000, 0.0000000000, 0.0000000000 >, 0.00149 texture {pigment
{color Yellow}  finish { phong 1 }}}
sphere {< 0.0026250000, 0.0000000000, 0.0000000000 >, 0.00149 texture {pigment
{color Yellow}  finish { phong 1 }}}


EXHIBITION 2:
http://imgur.com/AR7bD5V

#include "colors.inc"
 background { color White }
 camera
 { location <0.005, 0.01, 0.015>
   look_at <0.0, 0.0, 0.0> }
 light_source { <-0.01, 0.0, 0.2> color White}
 light_source { <0.01, 0.0, 0.2> color White}
cylinder {< -0.0052500000, 0.0000000000, 0.0000000000 >, < 0.0052500000,
0.0000000000, 0.0000000000 >, 0.0015000000 texture {pigment {color Red transmit
0.5} finish { phong 1 }}}
intersection{ sphere {<0.00525, 0.0, 0.0>, 0.0015}
       box {<0.00525,-0.002,-0.002>,<0.007,0.002,0.002>} texture {pigment {color
Red transmit 0.5} finish { phong 1 }} }
sphere {< -0.0052500000, 0.0000000000, 0.0000000000 >, 0.00142 texture {pigment
{color Yellow}  finish { phong 1 }}}
sphere {< 0.0052500000, 0.0000000000, 0.0000000000 >, 0.00142 texture {pigment
{color Yellow}  finish { phong 1 }}}
sphere {< -0.0026250000, 0.0000000000, 0.0000000000 >, 0.00142 texture {pigment
{color Yellow}  finish { phong 1 }}}
sphere {< 0.0000000000, 0.0000000000, 0.0000000000 >, 0.00142 texture {pigment
{color Yellow}  finish { phong 1 }}}
sphere {< 0.0026250000, 0.0000000000, 0.0000000000 >, 0.00142 texture {pigment
{color Yellow}  finish { phong 1 }}}


EXHIBITION 3:
http://imgur.com/Vs1zqhS

#include "colors.inc"
 background { color White }
 camera
 { location <0.005, 0.01, 0.015>
   look_at <0.0, 0.0, 0.0> }
 light_source { <-0.01, 0.0, 0.2> color White}
 light_source { <0.01, 0.0, 0.2> color White}
cylinder {< -0.0052500000, 0.0000000000, 0.0000000000 >, < 0.0052500000,
0.0000000000, 0.0000000000 >, 0.0015000000 texture {pigment {color Red transmit
0.5} finish { phong 1 }}}
intersection{ sphere {<0.00525, 0.0, 0.0>, 0.0015}
       box {<0.00525,-0.002,-0.002>,<0.007,0.002,0.002>} texture {pigment {color
Red transmit 0.5} finish { phong 1 }} }
sphere {< -0.0052500000, 0.0000000000, 0.0000000000 >, 0.0014 texture {pigment
{color Yellow}  finish { phong 1 }}}
sphere {< 0.0052500000, 0.0000000000, 0.0000000000 >, 0.0014 texture {pigment
{color Yellow}  finish { phong 1 }}}
sphere {< -0.0026250000, 0.0000000000, 0.0000000000 >, 0.0014 texture {pigment
{color Yellow}  finish { phong 1 }}}
sphere {< 0.0000000000, 0.0000000000, 0.0000000000 >, 0.0014 texture {pigment
{color Yellow}  finish { phong 1 }}}
sphere {< 0.0026250000, 0.0000000000, 0.0000000000 >, 0.0014 texture {pigment
{color Yellow}  finish { phong 1 }}}

In exhibition 3 it the red "shadows" disappear but the yellow spheres are
significantly smaller than the outer transparent spherocylinder.

I want to thank you in advance for any help.


Post a reply to this message

From: clipka
Subject: Re: Non-touching objects seem to be touching
Date: 10 Feb 2017 10:35:35
Message: <589dddc7$1@news.povray.org>
Am 10.02.2017 um 15:09 schrieb Nicki:
> I want to visualize opaque spheres inside a transparent spherocylinder (a
> cylinder with hemispherical caps at the ends).
> When I do so I get weird red spots on the spheres even though they should not be
> touching the transparent sphere. I have to make the spheres significantly
> smaller then the outer transparent spherocylinder so that this problem
> disappears.
> In the following I show you three scene-files and the corresponding images that
> show this problem.
> I would be happy to hear suggestions on how to get rid of this problem.

What you're seeing is a long-standing problem known as "[near]
coincident surfaces": If POV-Ray encounters one transparent or
semi-transparent surface, the ray traced from there onward will ignore
any surface within a particular distance.

The rationale for this behaviour is that the ray can't erroneously
re-encounter the transparent surface (or any surface truly coinciding
with it) again, which could happen due to rounding errors, and might
lead to a potentially infinite loop.

As a consequence, you need to make sure that you leave a bit of a gap
between any transparent or semi-transparent objects and adjacent objects.

Since the required minimum distance is a constant, scaling up the entire
scene allows you to get away with a smaller /relative/ distance.


Post a reply to this message

From: Nicki
Subject: Re: Non-touching objects seem to be touching
Date: 10 Feb 2017 11:15:00
Message: <web.589de6eaccd1a85e5e1b0d740@news.povray.org>
> What you're seeing is a long-standing problem known as "[near]
> coincident surfaces": If POV-Ray encounters one transparent or
> semi-transparent surface, the ray traced from there onward will ignore
> any surface within a particular distance.
>
> The rationale for this behaviour is that the ray can't erroneously
> re-encounter the transparent surface (or any surface truly coinciding
> with it) again, which could happen due to rounding errors, and might
> lead to a potentially infinite loop.
>
> As a consequence, you need to make sure that you leave a bit of a gap
> between any transparent or semi-transparent objects and adjacent objects.
>
> Since the required minimum distance is a constant, scaling up the entire
> scene allows you to get away with a smaller /relative/ distance.

Thank you very much for the quick help. Your explanation is most helpful and
comprehensible. And scaling everything up seems like a very reasonable solution.

I am sorry for having posted a recurring problem, my initial search didn't yield
any results.


Post a reply to this message

From: Stephen
Subject: Re: Non-touching objects seem to be touching
Date: 10 Feb 2017 11:48:45
Message: <589deeed$1@news.povray.org>
On 2/10/2017 4:14 PM, Nicki wrote:

> I am sorry for having posted a recurring problem, my initial search didn't yield
> any results.
>

No need to apologise you picked the right group to ask in. And every 
time it's asked it is described in a different way. :-)


-- 

Regards
     Stephen


Post a reply to this message

From: Alain
Subject: Re: Non-touching objects seem to be touching
Date: 10 Feb 2017 12:47:18
Message: <589dfca6$1@news.povray.org>

> I want to visualize opaque spheres inside a transparent spherocylinder (a
> cylinder with hemispherical caps at the ends).
> When I do so I get weird red spots on the spheres even though they should not be
> touching the transparent sphere. I have to make the spheres significantly
> smaller then the outer transparent spherocylinder so that this problem
> disappears.
> In the following I show you three scene-files and the corresponding images that
> show this problem.
> I would be happy to hear suggestions on how to get rid of this problem.
>

All your objects are really small.
Try multiplying all tour values by 1000. This will not affect the aspect 
of your objects, but can get rid of accuracy problems as well as isues 
regarding distances that are to small.
That way,
cylinder {< -0.0052500000, 0.0000000000, 0.0000000000 >, < 0.0052500000,
0.0000000000, 0.0000000000 >, 0.0015000000 texture {pigment {color Red 
transmit
0.5} finish { phong 1 }}}

becomes this :
cylinder {< -5.25, 0, 0 >, < 5.25,0, 0 >, 1.5 texture {pigment {color 
Red transmit
0.5} finish { phong 1 }}}


Alain


Post a reply to this message

From: Bald Eagle
Subject: Re: Non-touching objects seem to be touching
Date: 10 Feb 2017 13:05:01
Message: <web.589dffabccd1a85ec437ac910@news.povray.org>
Stephen <mca### [at] aolcom> wrote:

> No need to apologise you picked the right group to ask in. And every
> time it's asked it is described in a different way. :-)

And some of us had no idea it even existed.

Christoph - what IS the distance used?  And what should be the separation
distance?  Any value above that plus the minimum value that POV-Ray recognizes?


I'd probably also suggest that you make a tube or a sleeve if you still run into
problems.
I did:

#declare Sleeve =
difference {
 cylinder {< -0.0052500000, 0.0000000000, 0.0000000000 >, < 0.0052500000,
0.0000000000, 0.0000000000 >, 0.0015000000*1.001}
  cylinder {< -0.0052500000, 0.0000000000, 0.0000000000 >, < 0.0052500000,
0.0000000000, 0.0000000000 >, 0.0015000000}
 texture {pigment {color Red transmit 0.99}}
 no_shadow
}

 object {Sleeve}

But I had no idea the scale was an actual factor / cause of the problem.  It
just seemed an oddly small scale to work on, with awkward values.  ;)


Post a reply to this message

From: Stephen
Subject: Re: Non-touching objects seem to be touching
Date: 10 Feb 2017 14:55:44
Message: <589e1ac0$1@news.povray.org>
On 2/10/2017 6:00 PM, Bald Eagle wrote:
> #declare Sleeve =
> difference {
>   cylinder {< -0.0052500000, 0.0000000000, 0.0000000000 >, < 0.0052500000,
> 0.0000000000, 0.0000000000 >, 0.0015000000*1.001}
>    cylinder {< -0.0052500000, 0.0000000000, 0.0000000000 >, < 0.0052500000,
> 0.0000000000, 0.0000000000 >, 0.0015000000}
>   texture {pigment {color Red transmit 0.99}}
>   no_shadow
> }
>
>   object {Sleeve}
>
> But I had no idea the scale was an actual factor / cause of the problem.  It
> just seemed an oddly small scale to work on, with awkward values.;)


It looks like computer generated code. So Nicki is probably working with 
the figures the machine spits out.

BTW Welcome Nicki.

-- 

Regards
     Stephen


Post a reply to this message

From: Bald Eagle
Subject: Re: Non-touching objects seem to be touching
Date: 10 Feb 2017 15:20:01
Message: <web.589e205cccd1a85ec437ac910@news.povray.org>
BTW,
It looks like my "sleeve" idea (re)introduces the same problem at the scale I'm
using.  Only it looks to me like the sleeve interacts with _itself_

Uncomment the differenced-away cylinder and the red shading gets much darker.

I'm thinking that maybe some of these simple scenes that illustrate known
problems ought to wind up in a directory included with future versions, along
with any key hard-coded internal values in the comments.


#include "colors.inc"
background { color White }
camera {
 location <0.5, 0.5, 1.5>
 look_at  <0.0, 0.0,  0.0>
}
 light_source { <-1, 0.0, 2> color White}
 light_source { < 1, 0.0, 2> color White}

#declare Axis = 0.002;
cylinder {<0, 0, 0> <1, 0, 0> Axis pigment {Red} no_shadow}
cylinder {<0, 0, 0> <0, 1, 0> Axis pigment {Green} no_shadow}
cylinder {<0, 0, 0> <0, 0, 1> Axis pigment {Blue} no_shadow}

//cylinder {<-1, 0.0, 2> <0, 0, 0> 0.001 pigment {Green} no_shadow}
//cylinder {< 1, 0.0, 2> <0, 0, 0> 0.001 pigment {Green} no_shadow}

#declare Sleeve =
difference {
 cylinder {< -0.525, 0.000, 0.000 >, < 0.525, 0.000, 0.000 >, 0.15}
  //cylinder {< -0.525, 0.000, 0.000 >, < 0.525, 0.000, 0.000 >, 0.15-0.0005}
 texture {pigment {color Red transmit 0.5}}
 //no_shadow
}

 object {Sleeve}

intersection{
 sphere {<0.525,  0.0,  0.0>, 0.15}
     box    {<0.525, -0.3, -0.3>, <0.7, 0.3, 0.3>}
     texture {pigment {color Red transmit 0.5}}
 //no_shadow
}

union {
 sphere {<-0.5250, 0.000, 0.000 >, 0.149 }
 sphere {< 0.5250, 0.000, 0.000 >, 0.149 }
 sphere {<-0.2625, 0.000, 0.000 >, 0.149 }
 sphere {< 0.0000, 0.000, 0.000 >, 0.149 }
 sphere {< 0.2625, 0.000, 0.000 >, 0.149 }
 texture {pigment {color Yellow}  finish { phong 1 }}
}


Post a reply to this message

From: clipka
Subject: Re: Non-touching objects seem to be touching
Date: 10 Feb 2017 16:31:46
Message: <589e3142$1@news.povray.org>
Am 10.02.2017 um 19:00 schrieb Bald Eagle:
> Stephen <mca### [at] aolcom> wrote:
> 
>> No need to apologise you picked the right group to ask in. And every
>> time it's asked it is described in a different way. :-)
> 
> And some of us had no idea it even existed.
> 
> Christoph - what IS the distance used?  And what should be the separation
> distance?  Any value above that plus the minimum value that POV-Ray recognizes?

*Sigh!*
I had hoped nobody would ask...

The short answer is "just toy around with scene scale and distance until
you're happy".


The long answer is that there are /two/ minimum distance mechanisms,
/both/ of which may kick in independently:

- One mechanism uses a global constant, MIN_ISECT_DEPTH (defined as 1e-4
in POV-Ray 3.7), which is tested in global scene coordinate space.

- Another mechanism uses a constant depending on the type of primitive,
ranging from 1e-6 to 1e-2, which may be tested in global scene
coordinate space or some local coordinate space, also depending on the
type of primitive.


Post a reply to this message

From: Alain
Subject: Re: Non-touching objects seem to be touching
Date: 10 Feb 2017 18:52:52
Message: <589e5254$1@news.povray.org>
Le 17-02-10 à 14:55, Stephen a écrit :
> On 2/10/2017 6:00 PM, Bald Eagle wrote:
>> #declare Sleeve =
>> difference {
>>   cylinder {< -0.0052500000, 0.0000000000, 0.0000000000 >, <
>> 0.0052500000,
>> 0.0000000000, 0.0000000000 >, 0.0015000000*1.001}
>>    cylinder {< -0.0052500000, 0.0000000000, 0.0000000000 >, <
>> 0.0052500000,
>> 0.0000000000, 0.0000000000 >, 0.0015000000}
>>   texture {pigment {color Red transmit 0.99}}
>>   no_shadow
>> }
>>
>>   object {Sleeve}
>>
>> But I had no idea the scale was an actual factor / cause of the
>> problem.  It
>> just seemed an oddly small scale to work on, with awkward values.;)
>
>
> It looks like computer generated code. So Nicki is probably working with
> the figures the machine spits out.
>
> BTW Welcome Nicki.
>

When you have all those trailing zeros, it's a sign that it is computer 
generated.
My guess is that the scene dimentions is in the milimeter scale, with 
base unit defined as meter.
Using a base unit of 1 cm would be beter,  and 1 mm would probably be 
optimal. Also, there is nothing to prevent you from using 0.01 mm as a 
base unit. That way, all values, but one, becomes integers.


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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