POV-Ray : Newsgroups : povray.beta-test : Difference issue Server Time
23 Dec 2024 00:56:04 EST (-0500)
  Difference issue (Message 1 to 9 of 9)  
From: jotito
Subject: Difference issue
Date: 2 Jul 2012 22:40:01
Message: <web.4ff25aef19a8129f241198cb0@news.povray.org>
#version 3.7;

#include "textures.inc"

difference
{
   box{<-2,1,-2>, < 2,4, 2> }
   union
   {
      box{< 0,0,-3>, < 3,3, 3>}
      box{< 0,2,-3>, < 3,5, 3>}
   }
   texture {Gold_Texture}
}

light_source { <5,3,0> }

camera
{
  location <5,3,0>
  look_at <0,3,0>
  sky <0,1,0>
}

Rendering the above scene creates a box with some kind of hole in the middle.
The boxes in the union must be like a big box {< 0,0,-3>, < 3,5, 3>} but the
behavior is different.


Post a reply to this message

From: Alain
Subject: Re: Difference issue
Date: 3 Jul 2012 00:58:15
Message: <4ff27be7$1@news.povray.org>

After some changes...
> #version 3.7;
Mendatory:
global_settings{assumed_gamma 1}

>
> #include "textures.inc"
>
> //difference
union
> {
>     box{<-2,1,-2>, < 2,4, 2> }
Remove the useless union.
>    // union // This is not needed at all
>    // {
New colouring.
>        box{< 0,0,-3>, < 3,3, 3> pigment{rgbf<1,0.1,0.1,1>}}
>        box{< 0,2,-3>, < 3,5, 3> pigment{rgbf<0.1,0.1,1,1>}}
>    // }
>     pigment{rgb<0.1,1,0.1>}
> }
>
> light_source { <5,3,0> rgb 1}
This light is BLACK!
You must add some colour.
>
> camera
> {
Pull the camera back so we can see the whole thing
>    location <5,3,-9>
>    look_at <0,3,0>
>    sky <0,1,0>
> }
>
> Rendering the above scene creates a box with some kind of hole in the middle.
> The boxes in the union must be like a big box {< 0,0,-3>, < 3,5, 3>} but the
> behavior is different.
>
>

There is a construction problem as well as coincident surfaces that 
cause some additional problems.

Changing the difference to an union.
Giving distinct colour to each component...
Pull back the camera to -9*z
Adding a colour value to the light_source
and we get:

A smaller green box, a large red and a large blue box.
Most of the green box is inside the others.
The red and blue overlap.
The red and blue boxes have coincident surfaces. This can throw 
insideness tests off.

The problem is NOT version dependent, version 3.6 or 3.5 should render 
similarly.


Alain


Post a reply to this message

From: jotito
Subject: Re: Difference issue
Date: 3 Jul 2012 11:50:00
Message: <web.4ff31390fff3bb238aa27d610@news.povray.org>
> There is a construction problem as well as coincident surfaces that
> cause some additional problems.
>
> Changing the difference to an union.
> Giving distinct colour to each component...
> Pull back the camera to -9*z
> Adding a colour value to the light_source
> and we get:
>
> A smaller green box, a large red and a large blue box.
> Most of the green box is inside the others.
> The red and blue overlap.
> The red and blue boxes have coincident surfaces. This can throw
> insideness tests off.
>
> The problem is NOT version dependent, version 3.6 or 3.5 should render
> similarly.
>
>
> Alain

This bug is not present in version 3.6, I just rendered it in 3.6.2.

The boxes inside the union have coincident surfaces and that is causing the
problem. If I make an small change, lets say 3.0001 instead of 3, the problem
disappears. I hope you can fix this bug because is very annoying, and with
version 3.6 there was no problem.


Post a reply to this message

From: James Holsenback
Subject: Re: Difference issue
Date: 3 Jul 2012 13:25:01
Message: <4ff32aed$1@news.povray.org>
On 07/02/2012 10:37 PM, jotito wrote:
> #version 3.7;
>
> #include "textures.inc"
>
> difference
> {
>     box{<-2,1,-2>, < 2,4, 2> }
>     union
>     {
>        box{< 0,0,-3>, < 3,3, 3>}
>        box{< 0,2,-3>, < 3,5, 3>}
>     }
>     texture {Gold_Texture}
> }
>
> light_source { <5,3,0> }
>
> camera
> {
>    location <5,3,0>
>    look_at <0,3,0>
>    sky <0,1,0>
> }
>
> Rendering the above scene creates a box with some kind of hole in the middle.
> The boxes in the union must be like a big box {< 0,0,-3>, < 3,5, 3>} but the
> behavior is different.
>
>

OK ... so what's new (I'm confused) are you trying to do this:

difference
{
    box{<-2,1,-2>, < 2,4, 2> }
    box{< 0,0,-3>, < 3,2, 3> }
    box{< 0,3,-3>, < 3,5, 3> }
    texture {Gold_Texture}
}

or this:

difference
{
    box{<-2,1,-2>, < 2,4, 2> }
    box{< 0,0,-3>, < 3,3, 3> }
    box{< 0,2,-3>, < 3,5, 3> }
    texture {Gold_Texture}
}

because if it's the 2nd one why not just do this:

box{<-2,1,-2>, < 0,4, 2> }

.. I mean yer just choppin' off the pos x portion of the main box!

Jim


Post a reply to this message

From: jotito
Subject: Re: Difference issue
Date: 3 Jul 2012 14:40:01
Message: <web.4ff33c35fff3bb238aa27d610@news.povray.org>
>
> OK ... so what's new (I'm confused) are you trying to do this:
>
> difference
> {
>     box{<-2,1,-2>, < 2,4, 2> }
>     box{< 0,0,-3>, < 3,2, 3> }
>     box{< 0,3,-3>, < 3,5, 3> }
>     texture {Gold_Texture}
> }
>
> or this:
>
> difference
> {
>     box{<-2,1,-2>, < 2,4, 2> }
>     box{< 0,0,-3>, < 3,3, 3> }
>     box{< 0,2,-3>, < 3,5, 3> }
>     texture {Gold_Texture}
> }
>
> because if it's the 2nd one why not just do this:
>
> box{<-2,1,-2>, < 0,4, 2> }
>
> .. I mean yer just choppin' off the pos x portion of the main box!
>
> Jim

What I am doing is creating a Military Tank using CSG. I detected that a part of
the tank was hollow, or "semi-hollow". The same thing that happens when you
extract an object from itself:
difference
{
   box{A,B}
   box{A,B}
}

But I am aware of that problem and I always avoid it. So I made a detailed
inspection of the code. After hours of checking the code I finally found the
bug.

The code I posted here is just a minimal example of how to reproduce the bug.

Of course I can fix the thing with some "tricks", but that is not the point, I
think is better if a bug is fixed rather than avoiding it using tricks.

I am not asking for a way to avoid the bug, what I want is to inform the
existence of this bug.


Post a reply to this message

From: James Holsenback
Subject: Re: Difference issue
Date: 3 Jul 2012 15:50:21
Message: <4ff34cfd$1@news.povray.org>
On 07/03/2012 02:38 PM, jotito wrote:
>>
>> OK ... so what's new (I'm confused) are you trying to do this:
>>
>> difference
>> {
>>      box{<-2,1,-2>, < 2,4, 2> }
>>      box{< 0,0,-3>, < 3,2, 3> }
>>      box{< 0,3,-3>, < 3,5, 3> }
>>      texture {Gold_Texture}
>> }
>>
>> or this:
>>
>> difference
>> {
>>      box{<-2,1,-2>, < 2,4, 2> }
>>      box{< 0,0,-3>, < 3,3, 3> }
>>      box{< 0,2,-3>, < 3,5, 3> }
>>      texture {Gold_Texture}
>> }
>>
>> because if it's the 2nd one why not just do this:
>>
>> box{<-2,1,-2>, < 0,4, 2> }
>>
>> .. I mean yer just choppin' off the pos x portion of the main box!
>>
>> Jim
>
> What I am doing is creating a Military Tank using CSG. I detected that a part of
> the tank was hollow, or "semi-hollow". The same thing that happens when you
> extract an object from itself:
> difference
> {
>     box{A,B}
>     box{A,B}
> }

1 - 1 = 0 ... for a hollow box with thickness to the walls, the inside 
box HAS to be smaller than the outside box and unioned with an even 
smaller box that extends below the outside boxes outer dimension (-y 
relative to the outer box. If you want a hollow shelled box then just 
use a single box with the hollow object modifier.


Post a reply to this message

From: jotito
Subject: Re: Difference issue
Date: 3 Jul 2012 17:35:01
Message: <web.4ff36541fff3bb238aa27d610@news.povray.org>
> There is a construction problem as well as coincident surfaces that
> cause some additional problems.
>
> Changing the difference to an union.
> Giving distinct colour to each component...
> Pull back the camera to -9*z
> Adding a colour value to the light_source
> and we get:
>
> A smaller green box, a large red and a large blue box.
> Most of the green box is inside the others.
> The red and blue overlap.
> The red and blue boxes have coincident surfaces. This can throw
> insideness tests off.
>
> The problem is NOT version dependent, version 3.6 or 3.5 should render
> similarly.
>
>
> Alain

After several tests I just find that the problem actually is the same in 3.6 and
3.7, the code I tested in 3.6 was a different one. So the problem is NOT version
dependent.

I guess will be better to use Blender or other software. I can not continue
searching for holes or other issues in my model.

Best regards.


Post a reply to this message

From: clipka
Subject: Re: Difference issue
Date: 3 Jul 2012 17:51:15
Message: <4ff36953@news.povray.org>
Am 03.07.2012 17:45, schrieb jotito:

> This bug is not present in version 3.6, I just rendered it in 3.6.2.

I did the same, but with a different result. Using version 
3.6.2.msvc9.win64 (on Windows 7), the scene you posted (minus the 
#version statement) /does/ exhibit the very same issues as when using 
version 3.7 RC6.


The underlying problem is that differences are internally modeled as the 
intersection of the first object and the inverted remaining object(s). 
An inverted CSG union in turn is modeled as a CSG intersection of its 
inverted members. And intersections, like merges, are inherently 
susceptible to coincident-surface problems.

While at first glance it might seem that the problem could be solved by 
representing an inverted CSG union as a CSG union with its inside test 
result inverted, that approach doesn't quite cut it; you'd actually need 
to use a CSG merge there rather than a union, and as mentioned before 
merges are just as problematic as intersections. (As a matter of fact, 
at its core the intersection /is/ implemented pretty much like a merge 
with inverted inside test result).


Post a reply to this message

From: Alain
Subject: Re: Difference issue
Date: 3 Jul 2012 19:12:44
Message: <4ff37c6c$1@news.povray.org>

>> There is a construction problem as well as coincident surfaces that
>> cause some additional problems.
>>
>> Changing the difference to an union.
>> Giving distinct colour to each component...
>> Pull back the camera to -9*z
>> Adding a colour value to the light_source
>> and we get:
>>
>> A smaller green box, a large red and a large blue box.
>> Most of the green box is inside the others.
>> The red and blue overlap.
>> The red and blue boxes have coincident surfaces. This can throw
>> insideness tests off.
>>
>> The problem is NOT version dependent, version 3.6 or 3.5 should render
>> similarly.
>>
>>
>> Alain
>
> This bug is not present in version 3.6, I just rendered it in 3.6.2.
>
> The boxes inside the union have coincident surfaces and that is causing the
> problem. If I make an small change, lets say 3.0001 instead of 3, the problem
> disappears. I hope you can fix this bug because is very annoying, and with
> version 3.6 there was no problem.
>
>
>

Just tested with 3.6.2 and 3.7RC6
Same resolution, exactly same code, and the result is THE SAME! Just as 
I said it should in my first post.
OK, the coincident noise pattern is different, but it's normal and must 
be expected. Then there is the case of gamma handling, but adding
global_settings{assumed_gamma 2.2}
or
global_settings{assumed_gamma 1}
to both versions gives identical results except for the random noise 
pattern.

You are abusing a limitation to do some manipulations that could me 
acheived in a way more reliable maner.

In your case, replace your 2 cutting objects by a single one and use a 
gradient pattern to have a transparent strip or use clipped_by to cut a 
hole.





Alain


Post a reply to this message

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