povray icon indicating copy to clipboard operation
povray copied to clipboard

Port of FS324 - 3.7 mesh2 rendering artifact, regression from 3.6.

Open wfpokorny opened this issue 8 years ago • 2 comments

http://bugs.povray.org/task/324

POV-Ray as of 3.7.1 commit 3cd6b6c still shows the original issue.

For all files from original report see: FS324.zip


Details:

Povray 3.7 has rendering artifact in meshes with polygons that meet at shallow angles. Please see the attached file.

The part of concern is the mesh2, which produces the partly-transparent faces of a shallow pyramid. The file result-3_6.png shows the output of povray-3.6, and the file result-3_7.png shows the output of povray-3.7. In 3.7, you can see a thin light-colored margin all around the base of the pyramid, especially thick under the top cylinder. In 3.6, this artifact is absent. For comparison purposes, I have inserted a "#version 3.6;" directive at the top of the file so that the output images are as close to each other as possible. However, the artifact is still present in 3.7 without this directive.

The attached scene file is only a small part of a much larger scene, where this artifact shows up in numerous very obvious places, where it doesn't in 3.6. I have hunted in the documentation and online for ways to solve this problem, but haven't found anything. Because of this, I am forced to stay with 3.6 for production use, which is quite unfortunate since I'd like to take advantage of the new features of 3.7

<mesh2_bug.zip>


Comments:


Comment by Grimbert Jérôme (Le_Forgeron) - Sunday, 01 June 2014, 02:04 GMT+5

it seems tied to transparency (transmit 0.5 in scene) and triangles (or surface ?). Mesh/Mesh2 is irrelevant: it also occurs with union of triangles.

Alpha in rendered picture seems irrelevant: putting a background plane keep the problem of dual tone near the edge.

The resulting color seems to be the one that is encountered when only one surface instead of two are encountered. (but two are really crossed!)


Comment by Grimbert Jérôme (Le_Forgeron) - Sunday, 01 June 2014, 02:13 GMT+5

The +UA is not needed either, in the problem.

Reduced scene for the problem in 3.7;

#version 3.7;

global_settings {
  assumed_gamma 1.0
        max_trace_level 30
}

#local lookat = <0,0,0>;
#local base_lookfrom = <0.1, 0.2, -0.8>;
#local lookfrom = base_lookfrom*.6;

camera {
        location lookfrom
        look_at lookat
        right x*1.0/1.0
}

#declare P1=<0.03249196962329062993, -0.05257311121191336062, -0.19021130325903071179>;//,
#declare P2=<0.08792183440801312755, -0.05433868201739210785, -0.17584366881602625510>;//,
#declare P3=<0.05433868201739210785, 0.00000000000000000000, -0.19659919844279735712>;//,
#declare P4=<0.03429496250085656284, -0.08978537747014557480, -0.17957075494029114959>;//,
#declare P5=<0.00000000000000000000, -0.03429496250085656284, -0.20076620740872361259>;//,
#declare T1=texture { pigment { rgb<1,0,0> transmit 0.5 } finish { ambient 0.5 } }
union{
triangle { P1, P2, P3 texture {T1} }
//triangle { P1, P2, P4 texture {T1} }
//triangle { P1, P3, P5 texture {T1} }
//triangle { P1, P4, P5 texture {T1} }
//
triangle { P2, P3, P5 texture {T1} }
triangle { P2, P5, P4 texture {T1} }
        transform { rotate z*60 scale 1.3 }
no_shadow
}

Render with height/width ratio of 1 (+Hxxx +Wxxx)

The top border should be homogeneous. It is not so far.


Comment by Grimbert Jérôme (Le_Forgeron) - Sunday, 01 June 2014, 16:11 GMT+5

Even shorter

#version 3.6;
global_settings { assumed_gamma 1.0 max_trace_level 30 }

#local Lookfrom = <0.1, 0.2, -0.8>;

#declare P1=<0.03249196962329062993, -0.05257311121191336062, -0.19021130325903071179>;
#declare P2=<0.08792183440801312755, -0.05433868201739210785, -0.17584366881602625510>;
#declare P3=<0.05433868201739210785, 0.00000000000000000000, -0.19659919844279735712>;
#declare P4=<0.00000000000000000000, -0.03429496250085656284, -0.20076620740872361259>;
#declare C=(P1+P2+P3+P4)/4;
camera {
        location Lookfrom
        look_at C
        right x*image_width/image_height
  angle 10
}

#declare T1=texture { pigment { rgb<1,0,0> transmit 0.5 } finish { ambient 0.5 } }
triangle { P1, P2, P3 texture {T1} no_shadow }
triangle { P2, P3, P4 texture {T1} no_shadow  }

demo.png (10.7 KiB)


Comment by Grimbert Jérôme (Le_Forgeron) - Sunday, 01 June 2014, 16:30 GMT+5

It seems the bug occurs when the second surface is at less than 0.002 from the first intersection.

#version 3.6;
global_settings { assumed_gamma 1.0 max_trace_level 30 }

#local Lookfrom = <0.1, 0.2, -0.8>;

#declare P1=<0.03249196962329062993, -0.05257311121191336062, -0.19021130325903071179>;
#declare P5=<0.00000000000000000000, -0.03429496250085656284, -0.20076620740872361259>;
#declare P2=<0.08792183440801312755, -0.05433868201739210785, -0.17584366881602625510>;
#declare P3=<0.05433868201739210785, 0.00000000000000000000, -0.19659919844279735712>;
#declare P4=P1+(P5-P1)/19;
#declare C=(P1+P2+P3+P4)/4;
camera {
        location Lookfrom
        look_at C
        right x*image_width/image_height
  angle 10
}

#declare T1=texture { pigment { rgbt<1,1,0,0.5>  } finish { ambient 0.5 } }
#declare T2=texture { pigment { rgbt<1,0,1,0.5>  } finish { ambient 0.5 } }
triangle { P2, P3, P1 texture {T1} no_shadow }
triangle { P2, P3, P4 texture {T2} no_shadow }
#debug concat(str(vlength(P1-P4),3,5),"\n")

Comment by Grimbert Jérôme (Le_Forgeron) - Sunday, 01 June 2014, 16:43 GMT+5

Testing code... the issue is tied to MIN_ISECT_DEPTH (changing it from 1e-4 to 1e-5, in source/backend/configbackend.h, reduces by 10 the size of the issue).


Comment by Grimbert Jérôme (Le_Forgeron) - Tuesday, 03 June 2014, 00:10 GMT+5

Updated to definite bug, all platforms.

History diving: MIN_ISECT_DEPTH was introduced with change #4117, 2006-04-03, from an issue with balcony.pov which did not render the liquid. SMALL_TOLERANCE (as 1e-3) was used in the previous code. The value of MIN_ISECT_DEPTH is just a tenth of it, pure magic. It has not been adjusted since that time.

The previous code tested for > SMALL_TOLERANCE. The new code tests for >= MIN_ISECT_DEPTH. (backend/scene/objects.cpp & backend/render/trace.cpp ;places are noted for [cjc] )

The value also replaced the tolerance for detecting the intersection of bounding boxes. (backend/scene/objects.cpp)

From my understanding, the tests for additional intersection (avoiding perfect hit) would be also fine with > MIN_ISECT_DEPTH, and MIN_ISECT_DEPTH to 0.0; Yet the bounding box need a fuzzy factor, so maybe SMALL_TOLERANCE should be back there (loosing a bit of performance, not even sure the noise of bounding box is that bad).

From looking at 3.6.1, the test to check that the distance was at least > SMALL_TOLERANCE was not even there.

Opinions are welcome.


Comment by Grimbert Jérôme (Le_Forgeron) - Tuesday, 03 June 2014, 01:53 GMT+5

Using imagemagick to compare the balcony scene ( compare -metric AE -fuzz 5% B36.png Bpatch.png -compose Src Delta_36_patch.png ), the sea is different (that's known and expectable, IIRC tied to noise generator; render done with +A0.01), and the glass is more similar to 3.6 with the previously suggested patch.

In 3.6, the shadow of the top of the glass is darker (in 3.7 the inside is white/clear), and the base of the shadow of the glass shows less the caustic (?) of the base of glass (or in 3.7, the base of the shadow of glass+liquid is brighter, unrealistic white).

Delta_36_37.png (21.6 KiB) Delta_36_patch.png (21.4 KiB)


Comment by Grimbert Jérôme (Le_Forgeron) - Saturday, 07 June 2014, 21:52 GMT+5

Proposal of correction in file delta. (diff)

delta (5.8 KiB)

All files in this zip:

FS324.zip

wfpokorny avatar Oct 15 '16 18:10 wfpokorny

@wfpokorny @LeForgeron Can you provide a TL;DR on the findings discussed in pull request #358?

c-lipka avatar Jun 11 '21 11:06 c-lipka

See my latest comment to pull #358 for more detail.

In short for v3.8 do nothing. Merge Jerome's pull request for v4.0.

wfpokorny avatar Jun 12 '21 14:06 wfpokorny