POV-Ray : Newsgroups : povray.newusers : Where is a bug ? Server Time
14 Sep 2025 15:50:20 EDT (-0400)
  Where is a bug ? (Message 1 to 10 of 16)  
Goto Latest 10 Messages Next 6 Messages >>>
From: kurtz le pirate
Subject: Where is a bug ?
Date: 1 Sep 2025 11:54:34
Message: <68b5c1ba$1@news.povray.org>
Hello,

The holidays are over. I've started a new project... which has me 
confused. I don't understand POV's behavior.


The attached image illustrates the issue well. Both objects are defined 
in the same way, but one is a union{} (magenta) and the other is a 
merge{} (cyan).

It's a very very simple object: two boxes and four cylinders.


So, why le merged object (in cyan) show a hole ?


<sdl>

#declare S = 11.00;
#declare R = 3.00;
#declare H = 0.50;

#declare corner = cylinder { <0, -H, 0>, <0, 0, 0>, R }

merge or union
   {
   box { <-S+R, -H, -S>, <+S-R, 0, +S> }
   box { <-S, -H, -S+R>, <+S, 0, +S-R> }

   object { corner translate <+(S-R), 0, +(S-R)> }
   object { corner translate <-(S-R), 0, +(S-R)> }
   object { corner translate <+(S-R), 0, -(S-R)> }
   object { corner translate <-(S-R), 0, -(S-R)> }
   }

</sdl>

For the rendering, I added a translate 15*y for the cyan object but the 
problem is not here.



If you have an idea...
Regards



ps : actually, I'm trying to understand how subsurface scattering works, 
and I've already noticed that this feature requires merge{} because 
union{} don't work, certainly due to surface coincidence.



-- 
kurtz le pirate
compagnie de la banquise


Post a reply to this message


Attachments:
Download 'bug.png' (39 KB)

Preview of image 'bug.png'
bug.png


 

From: Alain Martel
Subject: Re: Where is a bug ?
Date: 1 Sep 2025 12:23:22
Message: <68b5c87a$1@news.povray.org>
Le 2025-09-01 à 11:54, kurtz le pirate a écrit :
> 
> Hello,
> 
> The holidays are over. I've started a new project... which has me 
> confused. I don't understand POV's behavior.
> 
> 
> The attached image illustrates the issue well. Both objects are defined 
> in the same way, but one is a union{} (magenta) and the other is a 
> merge{} (cyan).
> 
> It's a very very simple object: two boxes and four cylinders.
> 
> 
> So, why le merged object (in cyan) show a hole ?
> 
> 
> <sdl>
> 
> #declare S = 11.00;
> #declare R = 3.00;
> #declare H = 0.50;
> 
> #declare corner = cylinder { <0, -H, 0>, <0, 0, 0>, R }
> 
> merge or union
>    {
>    box { <-S+R, -H, -S>, <+S-R, 0, +S> }
>    box { <-S, -H, -S+R>, <+S, 0, +S-R> }
> 
>    object { corner translate <+(S-R), 0, +(S-R)> }
>    object { corner translate <-(S-R), 0, +(S-R)> }
>    object { corner translate <+(S-R), 0, -(S-R)> }
>    object { corner translate <-(S-R), 0, -(S-R)> }
>    }
> 
> </sdl>
> 
> For the rendering, I added a translate 15*y for the cyan object but the 
> problem is not here.
> 
> 
> 
> If you have an idea...
> Regards
> 
> 
> 
> ps : actually, I'm trying to understand how subsurface scattering works, 
> and I've already noticed that this feature requires merge{} because 
> union{} don't work, certainly due to surface coincidence.
> 
> 
> 

The noise in the hole lead me to think that it may be a coincident 
surface issue.
The merge remove internal surfaces. When two surfaces are in the exact 
same location, you get all sort of glitches as the program can't tell 
witch one is inside and need to get removed.
Try moving one of the box up or down by a very small amount, like :
translate y*10^-7

Does that help ?


Post a reply to this message

From: Bald Eagle
Subject: Re: Where is a bug ?
Date: 1 Sep 2025 13:15:00
Message: <web.68b5d411b0e2b7faf625f77c25979125@news.povray.org>
kurtz le pirate <kur### [at] freefr> wrote:

> The attached image illustrates the issue well. Both objects are defined
> in the same way, but one is a union{} (magenta) and the other is a
> merge{} (cyan).
>
> It's a very very simple object: two boxes and four cylinders.

And that's the root of the problem:  it's TOO simple.

Remove the overlap of the two boxes by defining one central box, and adding FOUR
"leaves" or "wings" filling in the edges between the cylinder "corners".

Then I think it should work . . .

However, you may need to convert your corners from full cylinders to "pie
slices" by CSG - either home-rolled, or using Lohmueller's macro, which I
believe is in the drop-down insert menu as "segment of a cylinder"

-BE

(Perhaps do some other simple overlap tests to demonstrate what happens.)


Post a reply to this message

From: Alain Martel
Subject: Re: Where is a bug ?
Date: 1 Sep 2025 16:12:43
Message: <68b5fe3b$1@news.povray.org>
Le 2025-09-01 à 13:12, Bald Eagle a écrit :
> kurtz le pirate <kur### [at] freefr> wrote:
> 
>> The attached image illustrates the issue well. Both objects are defined
>> in the same way, but one is a union{} (magenta) and the other is a
>> merge{} (cyan).
>>
>> It's a very very simple object: two boxes and four cylinders.
> 
> And that's the root of the problem:  it's TOO simple.
> 
> Remove the overlap of the two boxes by defining one central box, and adding FOUR
> "leaves" or "wings" filling in the edges between the cylinder "corners".
> 
> Then I think it should work . . .
> 
> However, you may need to convert your corners from full cylinders to "pie
> slices" by CSG - either home-rolled, or using Lohmueller's macro, which I
> believe is in the drop-down insert menu as "segment of a cylinder"
> 
> -BE
> 
> (Perhaps do some other simple overlap tests to demonstrate what happens.)

For the overlap test, just make one of the boxes a different colour in 
the union case. That will show the coincident surfaces.

union
   {
   box { <-S+R, -H, -S>, <+S-R, 0, +S> pigment{rgb<0,1,0>}}
   box { <-S, -H, -S+R>, <+S, 0, +S-R> pigment{rgb<1,0,0>}}

   object { corner translate <+(S-R), 0, +(S-R)> pigment{rgb<0,0,1>}}
   object { corner translate <-(S-R), 0, +(S-R)> pigment{rgb<0,0,1>}}
   object { corner translate <+(S-R), 0, -(S-R)> pigment{rgb<0,0,1>}}
   object { corner translate <-(S-R), 0, -(S-R)> pigment{rgb<0,0,1>}}
   }

This will make all coincident surfaces obvious.


Post a reply to this message

From: Cousin Ricky
Subject: Re: Where is a bug ?
Date: 1 Sep 2025 16:42:03
Message: <68b6051b$1@news.povray.org>
On 2025-09-01 12:23 (-4), Alain Martel wrote:
> Le 2025-09-01 à 11:54, kurtz le pirate a écrit :
>>
>> #declare corner = cylinder { <0, -H, 0>, <0, 0, 0>, R }
>>
>> merge or union
>>    {
>>    box { <-S+R, -H, -S>, <+S-R, 0, +S> }
>>    box { <-S, -H, -S+R>, <+S, 0, +S-R> }
>>
>>    object { corner translate <+(S-R), 0, +(S-R)> }
>>    object { corner translate <-(S-R), 0, +(S-R)> }
>>    object { corner translate <+(S-R), 0, -(S-R)> }
>>    object { corner translate <-(S-R), 0, -(S-R)> }
>>    }
> 
> The noise in the hole lead me to think that it may be a coincident
> surface issue.
> The merge remove internal surfaces. When two surfaces are in the exact
> same location, you get all sort of glitches as the program can't tell
> witch one is inside and need to get removed.
> Try moving one of the box up or down by a very small amount, like :
> translate y*10^-7
> 
> Does that help ?

In fact, both boxes will need to be moved (one up, and one down),
because they also share coincident surfaces with the four cylinders.

P.S.  There is a typo: y*10^-7 should be y*10e-7.


Post a reply to this message

From: Cousin Ricky
Subject: Re: Where is a bug ?
Date: 1 Sep 2025 16:52:37
Message: <68b60795$1@news.povray.org>
On 2025-09-01 13:12 (-4), Bald Eagle wrote:
> kurtz le pirate <kur### [at] freefr> wrote:
> 
>> The attached image illustrates the issue well. Both objects are defined
>> in the same way, but one is a union{} (magenta) and the other is a
>> merge{} (cyan).
>>
>> It's a very very simple object: two boxes and four cylinders.
> 
> And that's the root of the problem:  it's TOO simple.
> 
> Remove the overlap of the two boxes by defining one central box, and adding FOUR
> "leaves" or "wings" filling in the edges between the cylinder "corners".
> 
> Then I think it should work . . .
> 
> However, you may need to convert your corners from full cylinders to "pie
> slices" by CSG - either home-rolled, or using Lohmueller's macro, which I
> believe is in the drop-down insert menu as "segment of a cylinder"

I'm not sure this will solve the problem; it may just result in a
different set of coincident surfaces.

If you want to see what I went through to build this shape without
coincident surfaces, take a look at macro RE__box_axis() in this file:
  https://github.com/CousinRicky/POV-RoundEdge/blob/main/roundedge.inc


Post a reply to this message

From: kurtz le pirate
Subject: Re: Where is a bug ?
Date: 2 Sep 2025 03:09:11
Message: <68b69817$1@news.povray.org>
Thank you for all your answers.



In fact, it's still and still the same problem of surfaces coincidence. 
Two boxes and four cylinders give too many cases to manage with epsilon 
translation in y.


And as BE says, this object is “too” simple :(
So I started working on a new geometry with no overlap.


<sdl>
// --- a quarter circle
#declare corner = difference {
  cylinder { <0, -H, 0>, <0, 0, 0>, R }
  plane { z,0 }
  plane { x, 0 }
  }


merge {
   // central box
   box { <-S+R, -H, -S+R>, <+S-R, 0, +S-R> }

   // left/right box
   box { <-S+R, -H, -S>, <S-R, 0, -S+R> }
   box { <-S+R, -H, S-R>, <S-R, 0, S> }

   // front/rear box
   box { <S, -H, -S+R>, <S-R, 0, S-R> }
   box { <-S, -H, -S+R>, <-S+R, 0, S-R> }

   // corners
   object { corner translate <+(S-R), 0, +(S-R)> }
   object { corner scale <-1,1,1> translate <-(S-R), 0, +(S-R)> }
   object { corner scale <1,1,-1> translate <+(S-R), 0, -(S-R)> }
   object { corner scale <-1,1,-1> translate <-(S-R), 0, -(S-R)> }

   }
</sdl>


Now everything seems fine.
I can restart my tests with SSS.



-- 
kurtz le pirate
compagnie de la banquise


Post a reply to this message

From: William F Pokorny
Subject: Re: Where is a bug ?
Date: 3 Sep 2025 13:24:21
Message: <68b879c5$1@news.povray.org>
On 9/2/25 03:09, kurtz le pirate wrote:
> merge {
...
>    }
> 
> 
> Now everything seems fine.
> I can restart my tests with SSS.

FWIW. An option, which might be faster than your merge{}, would be to 
use a bezier_spline prism{}.

Bill P.

//---
#version 3.8;
global_settings { assumed_gamma 1 }
#declare Grey50 = srgb <0.5,0.5,0.5>;
background { Grey50 }
#declare Camera00 = camera {
     perspective
     location <3,3,-3.001>
     sky y
     angle 35
     right x*(image_width/image_height)
     look_at <0,0,0>
}
#declare White = srgb <1,1,1>;
#declare Light00 = light_source { <50,150,-250>, White }
#declare Red = srgb <1,0,0>;
#declare CylinderX = cylinder { -1.1*x, 1.1*x, 0.01 pigment { Red } }
#declare Green = srgb <0,1,0>;
#declare CylinderY = cylinder { -1.1*y, 1.1*y, 0.01 pigment { Green } }
#declare Blue = srgb <0,0,1>;
#declare CylinderZ = cylinder { -1.1*z, 1.1*z, 0.01 pigment { Blue } }
#declare Orange = srgb <1,0.50196,0>;

//---
#declare Bot    = 0.0;           // Base of prism linear sweep
#declare Top    = 0.2;           // Top of prism linear sweep
#declare Frac   = 0.2;           // portion of +-1.0 edges rounded
#declare Shft   = 1.0-Frac;      // Normalize to 1x1 range
#declare ShftUR = <+Shft,+Shft>; // Shift up and right
#declare ShftUL = <-Shft,+Shft>; // Shift up and left
#declare ShftLL = <-Shft,-Shft>; // Shift lower and left
#declare ShftLR = <+Shft,-Shft>; // Shift lower and right
#declare Prism00 = prism {
     bezier_spline
     linear_sweep
     Bot, Top, 32,
     <1,0>*Frac+ShftUR,<1,0.552285>*Frac+ShftUR,
     <0.552285,1>*Frac+ShftUR,<0,1>*Frac+ShftUR,

     <+Shft,1>,<+Shft+Shft/3,1>,<-Shft+Shft/3,1>,<-Shft,1>,

     <0,1>*Frac+ShftUL,<-0.552285,1>*Frac+ShftUL,
     <-1,0.552285>*Frac+ShftUL,<-1,0>*Frac+ShftUL,

     <-1,+Shft>,<-1,+Shft-Shft/3>,<-1,-Shft+Shft/3>,<-1,-Shft>,

     <-1,0>*Frac+ShftLL,<-1,-0.552285>*Frac+ShftLL,
     <-0.552285,-1>*Frac+ShftLL,<0,-1>*Frac+ShftLL,

     <-Shft,-1>,<-Shft+Shft/3,-1>,<+Shft-Shft/3,-1>,<+Shft,-1>,

     <0,-1>*Frac+ShftLR,<0.552285,-1>*Frac+ShftLR,
     <1,-0.552285>*Frac+ShftLR,<1,0>*Frac+ShftLR

     <+1,-Shft>,<+1,-Shft+Shft/3>,<+1,+Shft-Shft/3>,<+1,+Shft>

     pigment { Orange }
}
#declare PrismCylinder = prism {  // Bezier spline cylinder approx
     bezier_spline
     linear_sweep
     Bot, Top, 16,
     <1,0>,<1,0.552285>,<0.552285,1>,<0,1>
     <0,1>,<-0.552285,1>,<-1,0.552285>,<-1,0>
     <-1,0>,<-1,-0.552285>,<-0.552285,-1>,<0,-1>
     <0,-1>,<0.552285,-1>,<1,-0.552285>,<1,0>
     pigment { Orange }
}

//--- scene ---
     camera { Camera00 }
     light_source { Light00 }
     object { CylinderX }
     object { CylinderY }
     object { CylinderZ }
     object { Prism00 }
//  object { PrismCylinder }  // Bezier spline cylinder approx
//---


Post a reply to this message

From: Bald Eagle
Subject: Re: Where is a bug ?
Date: 3 Sep 2025 14:25:00
Message: <web.68b887b1b0e2b7faf5d731ff25979125@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:

> FWIW. An option, which might be faster than your merge{}, would be to
> use a bezier_spline prism{}.

Dealing with chaos here, so I haven't thought this completely through...

But perhaps he could also use round box function / insert menu macro with
intersection, or my "rounded_box" (apparently unposted) variant with a very tiny
radius for the 2nd radius.

- BE


Post a reply to this message

From: William F Pokorny
Subject: Re: Where is a bug ?
Date: 3 Sep 2025 21:35:46
Message: <68b8ecf2$1@news.povray.org>
On 9/3/25 14:23, Bald Eagle wrote:
> William F Pokorny <ano### [at] anonymousorg> wrote:
> 
>> FWIW. An option, which might be faster than your merge{}, would be to
>> use a bezier_spline prism{}.
> 
> Dealing with chaos here, so I haven't thought this completely through...
> 
> But perhaps he could also use round box function / insert menu macro with
> intersection, or my "rounded_box" (apparently unposted) variant with a very tiny
> radius for the 2nd radius.
> 

Maybe... I thought too about the inbuilt f_rounded_box() function as an 
iso briefly, but to get the straight vertical sides I think we'd have to 
intersect with more or less the same corner shapes / box container being 
used in posted merge{}. Perhaps we could build up the isosurface with 
inbuilt, function similar shapes, matching what is in the merge. Whether 
that would faster than the merge{}, I don't know.

Bill P.


Post a reply to this message

Goto Latest 10 Messages Next 6 Messages >>>

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