POV-Ray : Newsgroups : povray.general : Artifacts when tracing somewhat high degree poly Server Time 9 Aug 2024 18:43:05 EDT (-0400)
 Artifacts when tracing somewhat high degree poly (Message 1 to 10 of 16)
 From: Adrien Subject: Artifacts when tracing somewhat high degree poly Date: 6 Dec 2022 04:05:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.638f05556eb8b15275a7ea2178e7deb4%40news.povray.org",
"headline": "Artifacts when tracing somewhat high degree poly",
"dateCreated": "2022-12-06T09:05:00+00:00",
"datePublished": "2022-12-06T09:05:00+00:00",
"author": {
"@type": "Person",
}
}
Hi,

I'm trying to use Povray to plot a surface defined by a polynomial equation
spitted out by an auxiliary program. However, whenever the degree of that
polynomial is 10 or more I get a bunch of artifacts/black dots. Is there a way
to fix that ? Either directly in Povray, or in the auxiliary program ?

I guess I could try to write a program that produces a mesh from my equation,
but this feels somewhat unefficient, my understanding is that raytracing
something defined by polynomial equations is "easy" because it's easy to check
whether a given point is a solution (as opposed to actually solve the equation).

Any hint or suggestion would be greatly appreciated ! Below is an example and
attached it the result.

#version version;
#include "colors.inc"
background { color White}
#declare maxG=100000000;
#declare maxC=10;

camera
{
location <0, 0, -6.5>
//  location <0, 0, -0.1>
//  focal_point <0,0,0>
// aperture 1.5
right x*image_width/image_height up <0,1,0>
look_at  <0.0, 0.0, 0.0>
angle 20
// blur_samples 5
}

light_source
{
2*<5, 10, -40>
color White
area_light <5, 0, 0>, <0, 5, 0>, 5, 5
}

#declare surf= texture{
finish {
ambient 0.0
diffuse 0.3
specular 0.2
roughness 0.1
reflection {0.0 metallic}
}
}
poly{10,
<1.0,0.0,0.0,0.0,5.0,0.0,0.0,5.0,-288.4708948753144,-1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,10.0,0.0,0.0,20.0,-11
53.8835795012576,-4.0,0.0,0.0,0.0,0.0,10.0,-1153.8835795012576,-16.0,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0
.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-1538.5114393350102,10.0,0.0,0.0,30.0,-1730.8253692518865,-6.0,0.0,0.0,0.0,0.0,3
0.0,-3461.650738503773,-48.0,0.0,-6.0,0.0,0.0,0.0,0.0,0.0,160.0,10.0,-1730.8253692518865,-42.0,384.62785983375255,-18.0
,576.9417897506288,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,15385.1143933501
03,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,5.0,0.0,0.0,20.0,-1153.8835795012576,-4.0,0.0,0.0,0.0,0.
0,30.0,-3461.650738503773,-48.0,0.0,-6.0,0.0,0.0,0.0,0.0,0.0,-320.0,20.0,-3461.650738503773,-84.0,769.2557196675051,-36
.0,1153.8835795012576,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,5.0,-1153.8835795012576,-40.0,769.2557196675051,-30.0,1923.13
92991687628,16.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-7692.55719667
5051,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.
0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,5.0,-288.4708948753144,-1.0,0.0,0.0,0.0,0.0,10.0,-1153.8835795012576,-16.0,0.0,-2.0,0
.0,0.0,0.0,0.0,0.0,32.0,10.0,-1730.8253692518865,-42.0,384.62785983375255,-18.0,576.9417897506288,2.0,0.0,0.0,0.0,0.0,0
.0,0.0,0.0,0.0,5.0,-1153.8835795012576,-40.0,769.2557196675051,-30.0,1923.1392991687628,16.0,0.0,1.0,0.0,0.0,0.0,0.0,0.
0,0.0,0.0,0.0,0.0,0.0,1.0,-288.4708948753144,-13.0,384.62785983375255,-14.0,1346.197509418134,14.0,384.62785983375255,1
3.0,-288.4708948753144,-1.0>
sturm on
texture {surf}
pigment {color Blue}
scale -0.4

rotate <0,45,0>
translate <0,0,-0.5>
scale -0.9}
```

Attachments:

Preview of image 'mwe.png'

 From: jr Subject: Re: Artifacts when tracing somewhat high degree poly Date: 6 Dec 2022 04:45:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.638f0e6399cae61ac0ce110b6cde94f1%40news.povray.org",
"headline": "Re: Artifacts when tracing somewhat high degree poly",
"dateCreated": "2022-12-06T09:45:00+00:00",
"datePublished": "2022-12-06T09:45:00+00:00",
"author": {
"@type": "Person",
"name": "jr"
}
}
hi,

> ...
> Any hint or suggestion ...

adding antialiasing options will help, as may playing with the lighting.
<https://wiki.povray.org/content/Reference:Tracing_Options#Anti-Aliasing_Options>

regards, jr.
```
 From: Adrien Subject: Re: Artifacts when tracing somewhat high degree poly Date: 6 Dec 2022 05:00:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.638f11ef99cae61a75a7ea2178e7deb4%40news.povray.org",
"headline": "Re: Artifacts when tracing somewhat high degree poly",
"dateCreated": "2022-12-06T10:00:00+00:00",
"datePublished": "2022-12-06T10:00:00+00:00",
"author": {
"@type": "Person",
}
}
Thanks for your answer. I should have said, I did try to play around with
various anti-aliasing options, but I get pretty much the same thing. Rendering
at a higher resolution doesn't help either.
```
 From: jr Subject: Re: Artifacts when tracing somewhat high degree poly Date: 6 Dec 2022 05:30:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.638f190999cae61ac0ce110b6cde94f1%40news.povray.org",
"headline": "Re: Artifacts when tracing somewhat high degree poly",
"dateCreated": "2022-12-06T10:30:00+00:00",
"datePublished": "2022-12-06T10:30:00+00:00",
"author": {
"@type": "Person",
"name": "jr"
}
}
hi,

> Thanks for your answer. I should have said, I did try to play around with
> various anti-aliasing options, but I get pretty much the same thing. Rendering
> at a higher resolution doesn't help either.

and rendered it (using a v3.8 alpha) with
\$ povray file.pov +a +am3 +a0.05 +ac0.99 +ag1 -j +q9

while there still are some artefacts, and, fwiw, I'm not an expert on textures
and lights etc, the settings helped, see attached.  am confident others can

regards, jr.
```

Attachments:

 From: Bald Eagle Subject: Re: Artifacts when tracing somewhat high degree poly Date: 6 Dec 2022 07:00:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.638f2dc099cae61a1f9dae3025979125%40news.povray.org",
"headline": "Re: Artifacts when tracing somewhat high degree poly",
"dateCreated": "2022-12-06T12:00:00+00:00",
"datePublished": "2022-12-06T12:00:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
It looks like you're doing everything right, and jr's use of the rendering
option sure helped.

The only other things I can think of are changing the incident ray angles a bit
by moving the poly or camera

But I think that maybe this is an accuracy thing with the roots of the equation,
so maybe since the surface is infinitely thin, do something like creating a very
thin shell using "abs(Function (x, y, z)) - a very small value".

The other thing you could try is make it an isosurface and see if somehow that
works any better.  You can also employ the shell method with that as well.

That's all I've got right now.

Very cool surface, by the way   :)
I might look at this for inspiration if I ever fool around with refining my
modeling of the "schist disk" again.
```
 From: Adrien Subject: Re: Artifacts when tracing somewhat high degree poly Date: 6 Dec 2022 07:25:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.638f33d199cae61a75a7ea2178e7deb4%40news.povray.org",
"headline": "Re: Artifacts when tracing somewhat high degree poly",
"dateCreated": "2022-12-06T12:25:00+00:00",
"datePublished": "2022-12-06T12:25:00+00:00",
"author": {
"@type": "Person",
}
}
>
> I added the recommended 'global_settings {assumed_gamma 1}' line to your code
> and rendered it (using a v3.8 alpha) with
>   \$ povray file.pov +a +am3 +a0.05 +ac0.99 +ag1 -j +q9
>

Fantastic, thanks a lot ! I was being dumb, I tried the +AM3 otion, but didn't
realized I also had to add +A, this is already much better with this ! I'll try
and play with these other settings as well.
```
 From: Adrien Subject: Re: Artifacts when tracing somewhat high degree poly Date: 6 Dec 2022 07:40:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.638f371999cae61a75a7ea2178e7deb4%40news.povray.org",
"headline": "Re: Artifacts when tracing somewhat high degree poly",
"dateCreated": "2022-12-06T12:40:00+00:00",
"datePublished": "2022-12-06T12:40:00+00:00",
"author": {
"@type": "Person",
}
}
> But I think that maybe this is an accuracy thing with the roots of the equation,
> so maybe since the surface is infinitely thin, do something like creating a very
> thin shell using "abs(Function (x, y, z)) - a very small value".
>
> The other thing you could try is make it an isosurface and see if somehow that
> works any better.  You can also employ the shell method with that as well.
>
> That's all I've got right now.

I actually wrote this a while ago, and at that time I think I tried with an
isosurface but can't remember what was not working (on the top of my head I'd
say it was unpractically slow ?)

>
> Very cool surface, by the way   :)
> I might look at this for inspiration if I ever fool around with refining my
> modeling of the "schist disk" again.

Thanks :) This is kind of a classic actually, a so-called Seifert surface for a
torus knot. I isolated the problematic part when asking this question but if
you're curious here is what I actually wanted to plot (using jr tweaks ! Thought
I get an error from the +ac0.99 option, I'll try to figure out why).
```

Attachments:

Preview of image 'out.png'

 From: jr Subject: Re: Artifacts when tracing somewhat high degree poly Date: 6 Dec 2022 08:50:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.638f476899cae61ac0ce110b6cde94f1%40news.povray.org",
"headline": "Re: Artifacts when tracing somewhat high degree poly",
"dateCreated": "2022-12-06T13:50:00+00:00",
"datePublished": "2022-12-06T13:50:00+00:00",
"author": {
"@type": "Person",
"name": "jr"
}
}
hi,

> > ...
> Fantastic, thanks a lot ! ...

great.  (and, pleasure)

> ... Thought I get an error from the +ac0.99 option, I'll try to figure out why.

you do use a v3.8?

regards, jr.
```
 From: William F Pokorny Subject: Re: Artifacts when tracing somewhat high degree poly Date: 6 Dec 2022 09:57:22 Message: <638f5852\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#638f5852%241%40news.povray.org",
"headline": "Re: Artifacts when tracing somewhat high degree poly",
"dateCreated": "2022-12-06T14:57:22+00:00",
"datePublished": "2022-12-06T14:57:22+00:00",
"author": {
"@type": "Person",
"name": "William F Pokorny"
}
}
> I'm trying to use Povray to plot a surface defined by a polynomial equation
> spitted out by an auxiliary program. However, whenever the degree of that
> polynomial is 10 or more I get a bunch of artifacts/black dots. Is there a way
> to fix that ? Either directly in Povray, or in the auxiliary program ?

As per others, stronger AA in official POV-Ray is probably your best /
quick solution.

---
FWIW.

a) The box-ish fails in your original image are very likely related to
the shadow cache bugs (there are 2.5 of these in official releases).

b) The general spotty result is at lest somewhat related to issues with
the official sturmiam based solver.

c) Some of the spotty result is shadow tolerance related coupled to how
accurate the sturm solver results are.

d) The results are somewhat inaccurate simply because it's a tenth order
poly.

Attached an image using my current povr branch where a and b already
better due fixes.

changing the default from 1e-3 to 1e-2 in this particular case. Here the
results just are a little inaccurate due the 10th order and we pick up
at surface roots during shadow testing as real blockage when the roots
are inaccurate representations of the ray origin root(d)...

Attached a povr result using no AA, default shadow tolerance of 1e-3.

Bill P.
```

Attachments:

 From: Thomas de Groot Subject: Re: Artifacts when tracing somewhat high degree poly Date: 6 Dec 2022 11:14:08 Message: <638f6a50\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#638f6a50%241%40news.povray.org",
"headline": "Re: Artifacts when tracing somewhat high degree poly",
"dateCreated": "2022-12-06T16:14:08+00:00",
"datePublished": "2022-12-06T16:14:08+00:00",
"author": {
"@type": "Person",
"name": "Thomas de Groot"
}
}
Op 6-12-2022 om 14:45 schreef jr:
> hi,
>
>>> ...
>> Fantastic, thanks a lot ! ...
>
> great.  (and, pleasure)
>
>
>> ... Thought I get an error from the +ac0.99 option, I'll try to figure out why.
>
> you do use a v3.8?
>
>
Artefacts (almost) disappear with:

+am3 +a0.01 +ac0.99 +r4

--
Thomas
```