POV-Ray : Newsgroups : povray.binaries.images : Strange Artifacts Server Time
11 Oct 2026 11:04:52 EDT (-0400)
  Strange Artifacts (Message 1 to 25 of 25)  
From: Jörg 'Yadgar' Bleimann
Subject: Strange Artifacts
Date: 30 Sep 2011 05:47:56
Message: <4e85904c@news.povray.org>
Hi(gh)!

With my current house project ("Port Whatmough Residential Area") I 
encountered some strange artifacts when I tried to join two segments of 
a roof railing (a straight and a curved one) with a sphere.

The curved segment follows a rounded 90° cutout of the ground floor 
having a radius of 3.5 units; as the railing generally is spaced 0.1 
units inwards from the roof's eged, the curved segment's (technically a 
section of a torus) radius is 3.6 units, therefore it's angular size is 
slightly less than 90° (see second attached image).

Although I've taken the resulting difference in the x direction (which 
calculates as cos(atan(0.1/3.6))*3.6) relative to the eastern end of the 
straight section into account, the spherical cornerpiece still does not 
fit seamlessly.

Also, along both railing sections, strange dots like those resulting 
from coincident surfaces are visible - but there is no concurrent 
surface at all!

See you in Khyberspace!

Yadgar


Post a reply to this message


Attachments:
Download '2011-09-30 port whatmough residential building #1, take 46 - extreme close-up of southern end of ground floor cutout rai' (16 KB) Download 'artifact_problem.jpg' (20 KB)

Preview of image '2011-09-30 port whatmough residential building #1, take 46 - extreme close-up of southern end of ground floor cutout rai'
2011-09-30 port whatmough residential building #1, take 46 - extreme close-up of southern end of ground floor cutout rai

Preview of image 'artifact_problem.jpg'
artifact_problem.jpg


 

From: Le Forgeron
Subject: Re: Strange Artifacts
Date: 30 Sep 2011 07:20:50
Message: <4e85a612@news.povray.org>
Le 30/09/2011 11:47, Jörg 'Yadgar' Bleimann a écrit :
> Also, along both railing sections, strange dots like those resulting
> from coincident surfaces are visible - but there is no concurrent
> surface at all!

What are you using for the railing sections ? spheresweep ?
hand made macro of sphere & cylinder ?


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Strange Artifacts
Date: 30 Sep 2011 07:57:08
Message: <4e85ae94@news.povray.org>
Hi(gh)!

On 30.09.2011 13:20, Le_Forgeron wrote:

> What are you using for the railing sections ? spheresweep ?
> hand made macro of sphere&  cylinder ?

Just cylinders and (sections of) tori (spheres only where cylinders 
directly meet tori sections)... currently simply placed explicitly, 
later on I would like to program a macro to make my railing concept 
universally reusable (yes, also for the whole PoV-Ray community - I will 
place the macro in the povray.org object library)!

Attached is a view of another portion of the railing, showing how a 
standard 90° corner is supposed to look like... the scene uses a basic 
radiosity (just radiosity { } within the global_settings statement - 
could it be that the artifacts are caused by that crude radiosity?) 
which might improve with future versions.

See you in Khyberspace!

Yadgar


Post a reply to this message


Attachments:
Download '2011-09-30 port whatmough residential building #1, take 48 - northwestern corner of ground floor roof.jpg' (52 KB)

Preview of image '2011-09-30 port whatmough residential building #1, take 48 - northwestern corner of ground floor roof.jpg'
2011-09-30 port whatmough residential building #1, take 48 - northwestern corner of ground floor roof.jpg


 

From: Le Forgeron
Subject: Re: Strange Artifacts
Date: 30 Sep 2011 11:07:00
Message: <4e85db14@news.povray.org>
Le 30/09/2011 13:56, Jörg 'Yadgar' Bleimann a écrit :

> Attached is a view of another portion of the railing, showing how a
> standard 90° corner is supposed to look like...

The old mechanic in me is asking: how the hell do you assemble that ?
There is no visible crew on the holding vertical poles.
The horizontal rail seems to be made of one piece.
And the vertical poles seems to be fixed directly in the cement.

For your cylinder/sphere/torus seams... the intersection of a torus is a
circle (which connect to a sphere of same radius) only for 3 well-known
cutting planes. All other intersections of a torus with a plane is a 3D
curve which does not match a circle.

For a point P on a torus:
there is the plane parallel to the plane of symmetry of the torus.
there is the plane perpendicular to the previous plane and passing at
the centre of the torus.
and there is the plane for the Villarceaux circles. (also going via the
centre of the torus, with a slant)


Post a reply to this message

From: clipka
Subject: Re: Strange Artifacts
Date: 30 Sep 2011 14:21:50
Message: <4e8608be$1@news.povray.org>
Am 30.09.2011 11:47, schrieb Jörg 'Yadgar' Bleimann:
> Hi(gh)!
>
> With my current house project ("Port Whatmough Residential Area") I
> encountered some strange artifacts when I tried to join two segments of
> a roof railing (a straight and a curved one) with a sphere.
>
> The curved segment follows a rounded 90° cutout of the ground floor
> having a radius of 3.5 units; as the railing generally is spaced 0.1
> units inwards from the roof's eged, the curved segment's (technically a
> section of a torus) radius is 3.6 units, therefore it's angular size is
> slightly less than 90° (see second attached image).
>
> Although I've taken the resulting difference in the x direction (which
> calculates as cos(atan(0.1/3.6))*3.6) relative to the eastern end of the
> straight section into account, the spherical cornerpiece still does not
> fit seamlessly.

I think that should be:

     cos(asin(0.1/3.6))*3.6
   = sqrt(sqr(3.6)-sqr(0.1))

In addition, are you sure you cut the cylinder and torus properly?


Post a reply to this message

From: Le Forgeron
Subject: Re: Strange Artifacts
Date: 30 Sep 2011 15:53:52
Message: <4e861e50$1@news.povray.org>
Le 30/09/2011 20:21, clipka nous fit lire :
> Am 30.09.2011 11:47, schrieb Jörg 'Yadgar' Bleimann:
>> Hi(gh)!
>>
>> With my current house project ("Port Whatmough Residential Area") I
>> encountered some strange artifacts when I tried to join two segments of
>> a roof railing (a straight and a curved one) with a sphere.
>>
>> The curved segment follows a rounded 90° cutout of the ground floor
>> having a radius of 3.5 units; as the railing generally is spaced 0.1
>> units inwards from the roof's eged, the curved segment's (technically a
>> section of a torus) radius is 3.6 units, therefore it's angular size is
>> slightly less than 90° (see second attached image).
>>
>> Although I've taken the resulting difference in the x direction (which
>> calculates as cos(atan(0.1/3.6))*3.6) relative to the eastern end of the
>> straight section into account, the spherical cornerpiece still does not
>> fit seamlessly.
> 
> I think that should be:
> 
>     cos(asin(0.1/3.6))*3.6
>   = sqrt(sqr(3.6)-sqr(0.1))
> 
> In addition, are you sure you cut the cylinder and torus properly?

If, as I now think, he used a translation of the clipping plane, the
answer is no. (a rotation should have been used)


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Strange Artifacts
Date: 30 Sep 2011 17:05:51
Message: <4e862f2f$1@news.povray.org>
Hi(gh)!

Am 30.09.2011 21:53, schrieb Le_Forgeron:

>> In addition, are you sure you cut the cylinder and torus properly?
>
> If, as I now think, he used a translation of the clipping plane, the
> answer is no. (a rotation should have been used)

The cylinder is not cut at all, but defined according to the length of 
the straight rail piece, with equal y and z coordinates respectively at 
beginning and end, so there is no distortion. The torus is defined in 
default position, i. e. parallel to the x-z plane and cut by two boxes 
rotated only around the y axis, so the cut planes are always circles, 
not ellipses!

See you in Khyberspace!

Yadgar


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Strange Artifacts
Date: 30 Sep 2011 17:38:36
Message: <4e8636dc@news.povray.org>
Hi(gh)!

> I think that should be:
>
> cos(asin(0.1/3.6))*3.6
> = sqrt(sqr(3.6)-sqr(0.1))

With

<4.9+(3.6-sqrt(sqrt(3.6)-sqrt(0.1))), sh+rfh/(mr+1), 4.1>

as the sphere's coordinates rather than

<4.9+(3.6-cos(atan(0.1/3.6))*3.6), sh+rfh/(mr+1), 4.1>

the result is even worse - see attached image!

See you in Khyberspace!

Yadgar


Post a reply to this message


Attachments:
Download 'railing_corner.png' (19 KB)

Preview of image 'railing_corner.png'
railing_corner.png


 

From: clipka
Subject: Re: Strange Artifacts
Date: 30 Sep 2011 21:20:03
Message: <4e866ac3$1@news.povray.org>
Am 30.09.2011 23:38, schrieb Jörg 'Yadgar' Bleimann:
> Hi(gh)!
>
>> I think that should be:
>>
>> cos(asin(0.1/3.6))*3.6
>> = sqrt(sqr(3.6)-sqr(0.1))
>
> With
>
> <4.9+(3.6-sqrt(sqrt(3.6)-sqrt(0.1))), sh+rfh/(mr+1), 4.1>
> [...]
> the result is even worse - see attached image!

Of course: You mixed up sqrt and sqr :-P

My bad though, because sqr doesn't exist as a predefined formula in 
POV-Ray; so it should be:

   sqrt(3.6*3.6 - 0.1*0.1)


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Strange Artifacts
Date: 1 Oct 2011 13:26:28
Message: <4e874d44@news.povray.org>
Hi(gh)!

Am 01.10.2011 03:19, schrieb clipka:
> Of course: You mixed up sqrt and sqr :-P
>
> My bad though, because sqr doesn't exist as a predefined formula in
> POV-Ray; so it should be:
>
>    sqrt(3.6*3.6 - 0.1*0.1)

Now the result is the same like with my original version (see attachment)...

See you in Khyberspace!

Yadgar


Post a reply to this message


Attachments:
Download 'whatmough_residential.png' (29 KB)

Preview of image 'whatmough_residential.png'
whatmough_residential.png


 

From: clipka
Subject: Re: Strange Artifacts
Date: 1 Oct 2011 18:45:01
Message: <4e8797ed$1@news.povray.org>
Am 01.10.2011 19:26, schrieb Jörg 'Yadgar' Bleimann:

> Now the result is the same like with my original version (see
> attachment)...

I can't help but think that the torus and cylinder ends might be bogus.

Do you have some code for me to toy around with?


Post a reply to this message

From: Solar Mike
Subject: Re: Strange Artifacts
Date: 1 Oct 2011 20:45:01
Message: <web.4e87b3292d6bb20470368d3d0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 01.10.2011 19:26, schrieb Jörg 'Yadgar' Bleimann:
>
> > Now the result is the same like with my original version (see
> > attachment)...
>
> I can't help but think that the torus and cylinder ends might be bogus.
>
> Do you have some code for me to toy around with?

Also, an orthographic view from above could be illuminating.  Even if your
angles are correct it looks like the issue could be due to a miss calculation of
the torus center or radius.

Cheers,
Mike


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Strange Artifacts
Date: 2 Oct 2011 06:45:17
Message: <4e8840bd$1@news.povray.org>
Am 02.10.2011 00:44, schrieb clipka:
> Am 01.10.2011 19:26, schrieb Jörg 'Yadgar' Bleimann:
>
>> Now the result is the same like with my original version (see
>> attachment)...
>
> I can't help but think that the torus and cylinder ends might be bogus.
>
> Do you have some code for me to toy around with?

O.k., here it is:

#declare rfh = 1; // Roof railing total height
#declare ur = 0.025; // Upper rail radius
#declare or = 0.018; // Other rails' radius
#declare pr = 0.018; // Railing post radius
#declare cp = 0.08;  // Rail cornerpieces' radius
#declare fh = 0.02;  // Railing post foot height
#declare fpr = 0.005; // Railing post foot outer rounding radius
#declare jlt = 0.012; // Railing middle join loop thickness
#declare jlr = 0.005; // Railing middle join loop outer rounding radius
#declare jlw = 2*(jlr+pr); // Railing middle join loop width
#declare mr = 2;      // Number of middle rails
#declare rvsp = rfh/(mr+1); // Vertical spacing of rails

#declare F_Shiny =
finish
{
   diffuse 1
   brilliance 0.6
   specular 0.8
   roughness 0.05
}

#declare T_Red_Metal =
texture
{
   pigment { color rgb <0.8, 0, 0> }
   finish { F_Shiny }
}



   cylinder
   {
     <2.1+cp, sh+2*rfh/(mr+1), 4.1>, <4.9, sh+2*rfh/(mr+1), 4.1>, or
     texture { T_Red_Metal }
   }

   sphere
   {
   // sqrt(sqr(3.6)-sqr(0.1))
   // <4.9+(3.6-cos(atan(0.1/3.6))*3.6), sh+rfh/(mr+1), 4.1>, or
     <4.9+(3.6-sqrt(pow(3.6, 2)-pow(0.1, 2))), sh+rfh/(mr+1), 4.1>, or
     texture { T_Red_Metal }
   }

   difference // ground floor round cutout railing, lower rail
   {
     torus
     {
       3.6, or
     }
     box
     {
       <0, -(or+df), -(3.6+or+df)>, <3.6+or+df, or+df, 3.6+or+df>
     }
     box
     {
       <-(3.6+or+df), -(or+2*df), -(3.6+or+2*df)>, <3.6+or+2*df, or+2*df, 0>
       rotate <0, degrees(atan(0.1/3.5)), 0>
     }
     translate <8.5, sh+rfh/3, 4>
     texture { T_Red_Metal }
   }

See you in Khyberspace!

Yadgar


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Strange Artifacts
Date: 2 Oct 2011 07:00:46
Message: <4e88445e@news.povray.org>
Hi(gh)!

Am 02.10.2011 02:41, schrieb Solar Mike:

> Also, an orthographic view from above could be illuminating.  Even if your
> angles are correct it looks like the issue could be due to a miss calculation of
> the torus center or radius.

O.k.... with and without the spherical cornerpiece!

See you in Khyberspace!

Yadgar


Post a reply to this message


Attachments:
Download 'orthoview1.png' (66 KB) Download 'orthoview2.png' (65 KB)

Preview of image 'orthoview1.png'
orthoview1.png

Preview of image 'orthoview2.png'
orthoview2.png


 

From: clipka
Subject: Re: Strange Artifacts
Date: 2 Oct 2011 07:14:15
Message: <4e884787$1@news.povray.org>
Am 02.10.2011 12:45, schrieb Jörg 'Yadgar' Bleimann:

> cylinder
> {
> <2.1+cp, sh+2*rfh/(mr+1), 4.1>, <4.9, sh+2*rfh/(mr+1), 4.1>, or
                                    ~~~
Note that this does /not/ coincide with the sphere's center. You need to 
apply the small correction here as well to fix this...

> sphere
> {
> // sqrt(sqr(3.6)-sqr(0.1))
> // <4.9+(3.6-cos(atan(0.1/3.6))*3.6), sh+rfh/(mr+1), 4.1>, or
> <4.9+(3.6-sqrt(pow(3.6, 2)-pow(0.1, 2))), sh+rfh/(mr+1), 4.1>, or
> texture { T_Red_Metal }
> }

> difference // ground floor round cutout railing, lower rail
> {
> torus
> {
> 3.6, or
> }
> box
> {
> <0, -(or+df), -(3.6+or+df)>, <3.6+or+df, or+df, 3.6+or+df>
> }
> box
> {
> <-(3.6+or+df), -(or+2*df), -(3.6+or+2*df)>, <3.6+or+2*df, or+2*df, 0>
> rotate <0, degrees(atan(0.1/3.5)), 0>
                      ~~~~     ~~~
... and here you're miscalculating the angle, using both the wrong 
values (should be 0.1/3.6 rather than 0.1/3.5) and the wrong formula 
(should be asin rather than atan).


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Strange Artifacts
Date: 2 Oct 2011 16:43:13
Message: <4e88cce1@news.povray.org>
High!

Am 02.10.2011 13:13, schrieb clipka:
> Am 02.10.2011 12:45, schrieb Jörg 'Yadgar' Bleimann:
>
>> cylinder
>> {
>> <2.1+cp, sh+2*rfh/(mr+1), 4.1>, <4.9, sh+2*rfh/(mr+1), 4.1>, or
> ~~~
> Note that this does /not/ coincide with the sphere's center. You need to
> apply the small correction here as well to fix this...

Yes, that's obvious...

>> <-(3.6+or+df), -(or+2*df), -(3.6+or+2*df)>, <3.6+or+2*df, or+2*df, 0>
>> rotate <0, degrees(atan(0.1/3.5)), 0>
> ~~~~ ~~~
> ... and here you're miscalculating the angle, using both the wrong
> values (should be 0.1/3.6 rather than 0.1/3.5) and the wrong formula
> (should be asin rather than atan).

Oh...

After your suggested corrections, it looks almost perfect... but there 
are still those parallel rows of dots, just like there were 
coincindental surfaces!

See you in Khyberspace!

Yadgar


Post a reply to this message


Attachments:
Download 'railing_corner2.png' (25 KB)

Preview of image 'railing_corner2.png'
railing_corner2.png


 

From: Solar Mike
Subject: Re: Strange Artifacts
Date: 2 Oct 2011 16:55:01
Message: <web.4e88ce8d2d6bb20470368d3d0@news.povray.org>
I think the problem here lies in the assumption the use of 0.1, 3.5 and 3.6 as
the basis for triangle with the center of the torus, the bend in the rail.

Keeping the radius and 0.1, your delta X is more like 3.5986.  I think you will
be fine if you follow clipka's suggestion but the change you are calculating
should be subtracted from 4.9.  Also, I tend to have better success with these
things when I declare local points or values and share that between the objects
like:

#local bendX = 8.5 - sqrt(pow(3.6, 2)-pow(0.1, 2));
or
#local pBend = <8.5 - sqrt(pow(3.6, 2)-pow(0.1, 2)), sh+2*rfh/(mr+1), 4.1>;

Cheers,
Mike


Post a reply to this message

From: Solar Mike
Subject: Re: Strange Artifacts
Date: 2 Oct 2011 17:05:00
Message: <web.4e88d13f2d6bb20470368d3d0@news.povray.org>
> After your suggested corrections, it looks almost perfect... but there
> are still those parallel rows of dots, just like there were
> coincindental surfaces!
>
> See you in Khyberspace!
>
> Yadgar

Is it possible that those parallel rows of dots are from the railing on the
other side?


Post a reply to this message

From: Solar Mike
Subject: Re: Strange Artifacts
Date: 2 Oct 2011 17:40:00
Message: <web.4e88d9cb2d6bb20470368d3d0@news.povray.org>
Please ignore my comment about subtracting below.... I really should not post
with a head cold.

"Solar Mike" <wem### [at] yahooca> wrote:
> I think the problem here lies in the assumption the use of 0.1, 3.5 and 3.6 as
> the basis for triangle with the center of the torus, the bend in the rail.
>
> Keeping the radius and 0.1, your delta X is more like 3.5986.  I think you will
> be fine if you follow clipka's suggestion but the change you are calculating
> should be subtracted from 4.9.  Also, I tend to have better success with these
> things when I declare local points or values and share that between the objects
> like:
>
> #local bendX = 8.5 - sqrt(pow(3.6, 2)-pow(0.1, 2));
> or
> #local pBend = <8.5 - sqrt(pow(3.6, 2)-pow(0.1, 2)), sh+2*rfh/(mr+1), 4.1>;
>
> Cheers,
> Mike


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Strange Artifacts
Date: 3 Oct 2011 12:20:47
Message: <4e89e0df@news.povray.org>
Hi(gh)!

On 02.10.2011 23:01, Solar Mike wrote:

> Is it possible that those parallel rows of dots are from the railing on the
> other side?

As the view is from the roof's edge inwards and the texture does not 
contain reflection, this is not possible!

See you in Khyberspace!

Yadgar


Post a reply to this message

From: clipka
Subject: Re: Strange Artifacts
Date: 3 Oct 2011 21:55:54
Message: <4e8a67aa$1@news.povray.org>
Am 02.10.2011 22:43, schrieb Jörg 'Yadgar' Bleimann:

> After your suggested corrections, it looks almost perfect... but there
> are still those parallel rows of dots, just like there were
> coincindental surfaces!

For those I have no explanation so far. I'll probably need more code to 
find out anything (camera, lights, global settings... the whole smash).


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Strange Artifacts
Date: 4 Oct 2011 04:14:29
Message: <4e8ac065@news.povray.org>
High!

> For those I have no explanation so far. I'll probably need more code to
> find out anything (camera, lights, global settings... the whole smash).

Should I really post the 500+ lines of code here?

See you in Khyberspace!

Yadgar


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Strange Artifacts
Date: 4 Oct 2011 06:53:58
Message: <4e8ae5c6@news.povray.org>
On 04.10.2011 03:55, clipka wrote:

> For those I have no explanation so far. I'll probably need more code to
> find out anything (camera, lights, global settings... the whole smash).

Here it is, the whole smash:

// Residential area architectural study for Port Whatmough
// (C) 2011 Jörg "Yadgar" Bleimann

// SWITCHES

#declare r=1; // toggles basic radiosity: 0 = off, 1 = on

#declare av=0; // toggles assembly view: 0 = off, 1 = on


global_settings
{
   #if (r=1)
     radiosity { }
     ambient_light 0
   #else
     ambient_light 0.25
   #end
}


// PIGMENTS

#declare P_Sky =
pigment
{
   gradient y
   color_map
   {
     [0 rgb <0.7, 1, 1>]
     [0.2 rgb <0, 0.25, 1>]
     [1   rgb <0, 0.25, 1>]
   }
}

// FINISHES

#declare F_Standard =
finish
{
   diffuse 1
   brilliance 0.15
}

#declare F_Shiny =
finish
{
   diffuse 1
   brilliance 0.6
   specular 0.8
   roughness 0.05
}

// TEXTURES

#declare T_Simple_White =
texture
{
   pigment { color rgb 1 }
   finish { F_Standard }
}

#declare T_Red_Metal =
texture
{
   pigment { color rgb <0.8, 0, 0> }
   finish { F_Shiny }
}

#declare T_Soil =
texture
{
   pigment { color rgb <0.8, 0.65, 0.4> }
   finish { F_Standard }
}

// STANDARDIZED OBJECTS

#declare sh = 2.6; // storey overall height
#declare cl = 0.15; // ceiling thickness
#declare ow = 0.18; // outer walls thickness
#declare iw = 0.1;  // inner walls thickness
#declare wr = 0.1;  // window rounding radius

#declare df=0.0001; // difference value to add or subtract to avoid 
coincidental surfaces


#declare Column =
cylinder
{
   0, <0, sh, 0>, 0.1
}

#declare Suspension =
prism
{
   linear_sweep
   linear_spline
   0, 0.1, 5
   <0, 0>, <2, 0>, <4, sh>, <0, sh>, <0, 0>
}

#declare OuterStair=
box
{
   0, <0.3, 0.2, 0.6>
}

#declare OuterStairs=
union
{
   #declare st=sh;
   #declare i=1;
   #while (i<(sh/0.2)+1)
     object
     {
       OuterStair
       scale <i, 1, 1>
       translate <0, st-i*0.2, 0>
     }
     #declare i=i+1;
   #end
}

#declare OuterStairs_Balustrade=
prism
{
   linear_sweep
   linear_spline
   0, 0.1, 5
   <0, 0>, <3.9, 0>, <3.9, 0.9>, <0, sh+0.9>, <0, 0>
}

#declare rfh = 1; // Roof railing total height
#declare ur = 0.025; // Upper rail radius
#declare or = 0.018; // Other rails' radius
#declare pr = 0.018; // Railing post radius
#declare cp = 0.08;  // Rail cornerpieces' radius
#declare fh = 0.02;  // Railing post foot height
#declare fpr = 0.005; // Railing post foot outer rounding radius
#declare jlt = 0.012; // Railing middle join loop thickness
#declare jlr = 0.005; // Railing middle join loop outer rounding radius
#declare jlw = 2*(jlr+pr); // Railing middle join loop width
#declare mr = 2;      // Number of middle rails
#declare rvsp = rfh/(mr+1); // Vertical spacing of rails

#declare Railing_Post_Foot =
union
{
	difference
	{
		cylinder
		{
		  0, <0, 0.02, 0>, pr+0.024
		}
		cylinder
		{
		  <0, -df, 0>, <0, 0.02+df, 0>, pr
		}
		difference
		{
	    cylinder
	    {
		    <0, 0.02-fpr, 0>, <0, 0.02+df, 0>, pr+0.024+df
		  }
		  cylinder
		  {
		    <0, 0.02-fpr-df, 0>, <0, 0.02+2*df, 0>, pr+0.024-fpr
		  }
		}
	}
   torus
   {
     pr+0.024-fpr, fpr
     translate <0, 0.02-fpr, 0>
   }
}


#declare Railing_Join_Loop_Rounding_Cutout =
difference
{
   cylinder
   {
     <-jlr-df, 0, 0>, 0, pr+jlt+df
   }
   cylinder
   {
     <-jlr-2*df, 0, 0>, <df, 0, 0>, pr+jlt-jlr
   }
}

#declare Railing_Join_Loop_Rounding =
torus
{
   pr+jlt-jlr, jlr
   rotate <0, 0, 90>
}


#declare Railing_Join_Loop=
union
{
	difference
	{
		cylinder
		{
		  0, <jlw, 0, 0>, pr+jlt
		}
	  cylinder
	  {
	    <-df, 0, 0>, <jlw+df, 0, 0>, pr
	  }
	  object
	  {
	    Railing_Join_Loop_Rounding_Cutout
	    translate <jlr, 0, 0>
	  }
	  object
	  {
	    Railing_Join_Loop_Rounding_Cutout
	    rotate <0, 180, 0>
	    translate <jlr+2*pr, 0, 0>
	  }
	}
   object
   {
     Railing_Join_Loop_Rounding
     translate <jlr, 0, 0>
   }
   object
   {
     Railing_Join_Loop_Rounding
     translate <jlr+2*pr, 0, 0>
   }
}

#declare Upper_Railing_Join_Loop =
object
{
   Railing_Join_Loop
   scale ur/or
}


#declare Railing_Post_Lower_Segment =
cylinder
{
   0, <0, rvsp-or-(jlt/2), 0>, pr
}

#declare Railing_Post_Middle_Segment =
cylinder
{
   <0, or+(jlt/2), 0>, <0, rvsp-(or+jlt/2), 0>, pr
}

#declare Railing_Post_Upper_Segment =
cylinder
{
   <0, or+(jlt/2), 0>, <0, rvsp-(ur+jlt*(ur/or)/2), 0>, pr
}



#declare Railing_Post =
union
{
   object { Railing_Post_Foot }
   object { Railing_Post_Lower_Segment }
   #declare s=1;
   #while (s<mr)
     object { Railing_Join_Loop translate <-jlw/2, s*rvsp, 0> }
     object { Railing_Post_Middle_Segment translate <0, s*rvsp, 0> }
     #declare s=s+1;
   #end
   object { Railing_Join_Loop translate <-jlw/2, s*rvsp, 0> }
   object { Railing_Post_Upper_Segment translate <0, s*rvsp, 0> }
   object { Upper_Railing_Join_Loop translate <-jlw*(ur/or)/2, rfh, 0> }
}

#declare Railing_Rail_Cornerpiece =
difference
{
   torus
   {
     cp, or
   }
   box
   {
     -(cp+or+df), <cp+or+df, cp+or+df, 0>
   }
   box
   {
     <0, -(cp+or+2*df), cp+or+df>, <cp+or+2*df, cp+or+2*df, -(cp+or+2*df)>
   }
}

#declare Upper_Railing_Rail_Cornerpiece =
difference
{
   torus
   {
     cp, ur
   }
   box
   {
     -(cp+ur+df), <cp+ur+df, cp+ur+df, 0>
   }
   box
   {
     <0, -(cp+ur+2*df), cp+ur+df>, <cp+ur+2*df, cp+ur+2*df, -(cp+ur+2*df)>
   }
}

// ACTUAL SCENE


#if (av=0)
	sky_sphere
	{
	  pigment { P_Sky }
	}
	
	plane
	{
	  y, 0
	  texture { T_Soil }
	}
	
	union
	{
		difference
		{
			box // main block
			{
			  <2, 0, 4>, <14, sh, 12>
			}
		  cylinder // verandah cutout, western part
		  {
		    <8.5, -df, 4>, <8.5, sh+df, 4>, 3.5
		  }
		  box // verandah cutout, eastern part
		  {
		    <8.5, -df, 4-df>, <14+df, sh+df, 7.5>
		  }
		}
	  box
	  {
	    <11, sh-cl, 2>, <14, sh, 7.5>
	  }
	  object
	  {
	    Column
	    translate <11.1, 0, 2.1>
	  }
	  object
	  {
	    Column
	    translate <13.9, 0, 2.1>
	  }
	  box // 1st floor
	  {
	    <9, sh, 9.5>, <14, sh*2, 16>
	  }
	  difference
	  {
	    object { Suspension }
	    cylinder { <1.5, -df, 1.1>, <1.5, 0.1+df, 1.1>, 0.45 }
	    cylinder { <0.4, -df, 2>, <0.4, 0.1+df, 2>, 0.2 }
	    cylinder { <0.65, -df, 1.5>, <0.65, 0.1+df, 1.5>, 0.1 }
	    cylinder { <0.35, -df, 0.4>, <0.35, 0.1+df, 0.4>, 0.15 }
	    cylinder { <2.7, -df, 2.05>, <2.7, 0.1+df, 2.05>, 0.3 }
	    rotate <-90, -90, 0>
	    translate <13.9, 0, 12>
	  }
	  difference
	  {
	    object { Suspension }
	    cylinder { <0.7, -df, 1.9>, <0.7, 0.1+df, 1.9>, 0.45 }
	    cylinder { <1.6, -df, 0.4>, <1.6, 0.1+df, 0.4>, 0.2 }
	    cylinder { <0.6, -df, 0.8>, <0.6, 0.1+df, 0.8>, 0.1 }
	    cylinder { <3, -df, 2.3>, <3, 0.1+df, 2.3>, 0.15 }
	    cylinder { <1.9, -df, 1.2>, <1.9, 0.1+df, 1.2>, 0.3 }
	    rotate <-90, -90, 0>
	    translate <9, 0, 12>
	  }
	  object
	  {
	    OuterStairs
	    rotate <0, 180, 0>
	    translate <9, sh, 10.2>
	  }
	  object
	  {
	    OuterStairs_Balustrade
	    rotate <-90, 180, 0>
	    translate <9, sh, 9.5>
	  }
	  object
	  {
	    OuterStairs_Balustrade
	    rotate <-90, 180, 0>
	    translate <9, sh, 10.2>
	  }

		texture { T_Simple_White }
	}
	
	#declare p=0;
	#while (p<7)
	  object
	  {
	    Railing_Post
	    translate <2.5+p, sh, 11.9>
	    texture { T_Red_Metal }
	  }
	  #declare p=p+1;
	#end
	
   cylinder
   {
     <9+df, sh+rfh/(mr+1), 11.9>, <2.1+cp, sh+rfh/(mr+1), 11.9>, or
     texture { T_Red_Metal }
   }

   cylinder
   {
     <9+df, sh+2*rfh/(mr+1), 11.9>, <2.1+cp, sh+2*rfh/(mr+1), 11.9>, or
     texture { T_Red_Metal }
   }

   cylinder
   {
     <9+df, sh+rfh, 11.9>, <2.1+cp, sh+rfh, 11.9>, ur
     texture { T_Red_Metal }
   }



   #declare p=0;
	#while (p<mr)
	  object
     {
	    Railing_Rail_Cornerpiece
	    translate <2.1+cp, sh+(p+1)*(rfh/(mr+1)), 11.9-cp>
	    texture { T_Red_Metal }
	  }
	  #declare p=p+1;
	#end
	

	object
	{
	  Upper_Railing_Rail_Cornerpiece
	  translate <2.1+cp, sh+rfh, 11.9-cp>
	  texture { T_Red_Metal }
	}
	
	
	#declare p=0;
	#while (p<8)
	  object
	  {
	    Railing_Post
       rotate <0, 90, 0>
	    translate <2.1, sh, 11.5-p>
	    texture { T_Red_Metal }
	  }
	  #declare p=p+1;
	#end

   cylinder
   {
     <2.1, sh+rfh/(mr+1), 11.9-cp>, <2.1, sh+rfh/(mr+1), 4.1+cp>, or
     texture { T_Red_Metal }
   }

   cylinder
   {
     <2.1, sh+2*rfh/(mr+1), 11.9-cp>, <2.1, sh+2*rfh/(mr+1), 4.1+cp>, or
     texture { T_Red_Metal }
   }

   cylinder
   {
     <2.1, sh+rfh, 11.9-cp>, <2.1, sh+rfh, 4.1+cp>, ur
     texture { T_Red_Metal }
   }

   #declare p=0;
	#while (p<mr)
	  object
	  {
	    Railing_Rail_Cornerpiece
	    rotate <0, -90, 0>
	    translate <2.1+cp, sh+(p+1)*(rfh/(mr+1)), 4.1+cp>
	    texture { T_Red_Metal }
	  }
	  #declare p=p+1;
	#end
	
	object
	{
	  Upper_Railing_Rail_Cornerpiece
     rotate <0, -90, 0>
	  translate <2.1+cp, sh+rfh, 4.1+cp>
	  texture { T_Red_Metal }
	}

   cylinder
   {
     <2.1+cp, sh+rfh/(mr+1), 4.1>, <4.9+(3.6-sqrt(pow(3.6, 2)-pow(0.1, 
2))), sh+rfh/(mr+1), 4.1>, or
     texture { T_Red_Metal }
   }

   cylinder
   {
     <2.1+cp, sh+2*rfh/(mr+1), 4.1>, <4.9+(3.6-sqrt(pow(3.6, 2)-pow(0.1, 
2))), sh+2*rfh/(mr+1), 4.1>, or
     texture { T_Red_Metal }
   }

   cylinder
   {
     <2.1+cp, sh+rfh, 4.1>, <4.9+(3.6-sqrt(pow(3.6, 2)-pow(0.1, 2))), 
sh+rfh, 4.1>, ur
     texture { T_Red_Metal }
   }


	#declare p=0;
	#while (p<3)
	  object
	  {
	    Railing_Post
	    translate <2.5+p, sh, 4.1>
	    texture { T_Red_Metal }
	  }
	  #declare p=p+1;
	#end
	
	sphere
	{
           // sqrt(sqr(3.6)-sqr(0.1))
	  // <4.9+(3.6-cos(atan(0.1/3.6))*3.6), sh+rfh/(mr+1), 4.1>, or
	  <4.9+(3.6-sqrt(pow(3.6, 2)-pow(0.1, 2))), sh+rfh/(mr+1), 4.1>, or
	  texture { T_Red_Metal }
	}
	sphere
	{
	  <4.9, sh+2*rfh/(mr+1), 4.1>, or
	  texture { T_Red_Metal }
	}
	
	sphere
	{
	  <4.9, sh+rfh, 4.1>, ur
	  texture { T_Red_Metal }
	}
	

   difference // ground floor round cutout railing, lower rail
   {
		torus
		{
		  3.6, or
	  }
	  box
	  {
	    <0, -(or+df), -(3.6+or+df)>, <3.6+or+df, or+df, 3.6+or+df>
	  }
	  box
	  {
	    <-(3.6+or+df), -(or+2*df), -(3.6+or+2*df)>, <3.6+or+2*df, or+2*df, 0>
       rotate <0, degrees(asin(0.1/3.6)), 0>
	  }
	  translate <8.5, sh+rfh/3, 4>
	  texture { T_Red_Metal }
	}
	
	
	
	#declare p=0;
	#while (p<5)
	  object
	  {
	    Railing_Post
       rotate <0, 279+p*18, 0>
	    translate <8.5, sh, 4>+3.6*<sin(radians(279+p*18)), 0, 
cos(radians(279+p*18))>
	    texture { T_Red_Metal }
	  }
	  #declare p=p+1;
	#end

	#declare p=0;
	#while (p<3)
	  object
	  {
	    Railing_Post
	    translate <8.5+p, sh, 7.6>
	    texture { T_Red_Metal }
	  }
	  #declare p=p+1;
	#end

	#declare p=0;
	#while (p<5)
	  object
	  {
	    Railing_Post
       rotate <0, 90, 0>
	    translate <11.1, sh, 7-p>
	    texture { T_Red_Metal }
	  }
	  #declare p=p+1;
	#end

	#declare p=0;
	#while (p<3)
	  object
	  {
	    Railing_Post
	    translate <11.5+p, sh, 2.1>
	    texture { T_Red_Metal }
	  }
	  #declare p=p+1;
	#end

	#declare p=0;
	#while (p<7)
	  object
	  {
	    Railing_Post
       rotate <0, 90, 0>
	    translate <13.9, sh, 2.5+p>
	    texture { T_Red_Metal }
	  }
	  #declare p=p+1;
	#end
	
	// LIGHTING
	
	light_source
	{
	  <500000, 3000000, 700000>
	  color rgb 1
	}
	
	// CAMERAS
	
	#declare vp = 15; // selects viewpoint
	
	#switch (vp)
	  #case (0) // view from south
	    #declare CamPos = <8, 1.7, -10>;
	    #declare dir = 0;
	    #declare azi = 0;
	    #declare ang = 55;
	  #break
	  #case (1) // top view
	    #declare CamPos = <6, 30, 7>;
	    #declare dir = 0;
	    #declare azi = -89.9999;
	    #declare ang = 65;
	  #break
	  #case (2) // view from north
	    #declare CamPos = <9.5, 1.7, 25>;
	    #declare dir = 180;
	    #declare azi = 0;
	    #declare ang = 55;
	  #break
	  #case (3) // view from east
	    #declare CamPos = <30, 1.7, 9>;
	    #declare dir = 270;
	    #declare azi = 0;
	    #declare ang = 55;
	  #break
	  #case (4) // Outer stairs, view upstairs
	    #declare CamPos = <2.5, sh+1.7, 9.9>;
	    #declare dir = 90;
	    #declare azi = 0;
	    #declare ang = 55;
	  #break
	  #case (5) // Outer stairs, view downstairs
	    #declare CamPos = <9.5, 2*sh+1.7, 9.9>;
	    #declare dir = 270;
	    #declare azi = -40;
	    #declare ang = 55;
	  #break
	  #case (6) // oblique view from south
	    #declare CamPos = <8, 20, -10>;
	    #declare dir = 0;
	    #declare azi = -45;
	    #declare ang = 55;
	  #break
	  #case (7) // view to northwest from base of outer stairs
	    #declare CamPos = <3.5, sh+1.7, 9.9>;
	    #declare dir = 315;
	    #declare azi = -25;
	    #declare ang = 55;
	  #break
	  #case (8) // view to southeast from base of outer stairs
	    #declare CamPos = <3.5, sh+1.7, 9.9>;
	    #declare dir = 135;
	    #declare azi = -20;
	    #declare ang = 55;
	  #break
	  #case (9) // top view of northwestern corner of ground floor
	    #declare CamPos = <2.1+cp, sh+5, 11.9-cp>;
	    #declare dir = 0;
	    #declare azi = -89.9999;
	    #declare ang = 55;
	  #break
	  #case (10) // view to south-southwest from base of outer stairs
	    #declare CamPos = <3.5, sh+1.7, 9.9>;
	    #declare dir = 202.5;
	    #declare azi = -25;
	    #declare ang = 55;
	  #break
	  #case (11) // top view of southwestern corner of ground floor
	    #declare CamPos = <2.1+cp, sh+5, 4.1-cp>;
	    #declare dir = 0;
	    #declare azi = -89.9999;
	    #declare ang = 55;
	  #break
	  #case (12) // top view of round cutout of ground floor
	    #declare CamPos = <6.75, 1500, 4>;
	    #declare dir = 0;
	    #declare azi = -89.9999;
	    #declare ang = 55;
	  #break
	  #case (13) // top view of southern end of round cutout of ground floor
	    #declare CamPos = <4.9, sh+0.7, 4.1>;
	    #declare dir = 0;
	    #declare azi = -89.9999;
	    #declare ang = 55;
	  #break
	  #case (14) // close-up view of southern end of round cutout of ground 
floor
	    #declare CamPos = <5.9, sh+0.5, 3.1>;
	    #declare dir = 315;
	    #declare azi = -10;
	    #declare ang = 55;
	  #break
	  #case (15) // extreme close-up view of southern end of round cutout 
of ground floor
	    #declare CamPos = <5.9, sh+rfh/3, 3.1>;
	    #declare dir = 315;
	    #declare azi = -0;
	    #declare ang = 5;
	  #break
	#end
	
	#declare CamLook = <sin(radians(dir)) * cos(radians(azi)), 
sin(radians(azi)), cos(radians(dir)) * cos(radians(azi))>;
	
	camera
	{
	  location CamPos
	  look_at CamPos+CamLook
	  angle ang
	}
#else // assembly view
   sky_sphere
   {
     pigment { color rgb 0.7 }
   }

   light_source
   {
     <2000, 500, -2000>
     color rgb 1
   }

   object
   {
     Railing_Rail_Cornerpiece
     texture { T_Red_Metal }
   }

   camera
   {
     location <0, 0.4, 0>
     look_at 0
     angle 40
   }
#end

// end of code

See you in Khyberspace!

Yadgar


Post a reply to this message

From: clipka
Subject: Re: Strange Artifacts
Date: 4 Oct 2011 07:50:46
Message: <4e8af316$1@news.povray.org>
Am 04.10.2011 12:53, schrieb Jörg 'Yadgar' Bleimann:
> On 04.10.2011 03:55, clipka wrote:
>
>> For those I have no explanation so far. I'll probably need more code to
>> find out anything (camera, lights, global settings... the whole smash).
>
> Here it is, the whole smash:

The bad news for us is that this is indeed a bug. Apparently the math 
for the torus is very susceptible to rounding errors when the camera is 
inside a very thin torus, on (or very close to) the torus' "center 
plane". (The cylindrical part of the railing seems to be affected only 
because the torus, despite being cut away, still "projects" artifacts.) 
The bug might be pretty similar in nature to the artifacts seen in 
sphere sweeps.

The good news for you is that for obvious reasons these artifacts are 
highly unlikely to show up in your final render.


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Strange Artifacts
Date: 4 Oct 2011 08:03:23
Message: <4e8af60b$1@news.povray.org>
Hi(gh)!

On 04.10.2011 13:50, clipka wrote:
 > The bad news for us is that this is indeed a bug.
No, this is not really bad news - at least it does not show that even 
after 15 years of poving, I still get messed up with trivial beginners' 
mistakes...

 > The good news for you is that for obvious reasons these artifacts are 
highly unlikely to show up in your final render.
 >
Yes, very probably not... and in animations, these dots would be almost 
surely lost in compression!

See you in Khyberspace!

Yadgar


Post a reply to this message

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