|
|
On 5/24/21 12:25 AM, BayashiPascal wrote:
> Hi everyone,
> I have a question regarding texture_list applied to mesh of very small size.
> I've noticed that in such case artifacts appear in the texture. I can avoid the
> problem by scaling up the input mesh (generated by another app), and scaling it
> back down in the POV-Ray script, but if possible I'd like to avoid that.
> I guess this is a problem related to numerical accuracy, so maybe there is a
> parameter somewhere that would help ?? Or, is there something else I'm not aware
> of, and doing wrong ?
Yes, numerical accuracy it is.
In the POV-Ray source there is a defined EPSILON value of 1e-10 which
over time tended to be used whenever someone had need of a small
'epsilon' value.
However, there isn't a one size fits all EPSILON value. It depends on
the math being done. In triangle.cpp there is a function:
SmoothTriangle::Calculate_Smooth_T(..._)
with some code which reads:
if(dm1*dm1<EPSILON)
{
if(dm2*dm2<EPSILON)
{
if(dm3*dm3 < EPSILON)
{...
Using an 'epsilon' value of gkDBL_epsilon (~4.4e-16) which is generally
good for simpler double math, the textures for both your triangles
interpolate well.
The updated code looks like:
if(dm1*dm1 < gkDBL_epsilon)
{
if(dm2*dm2 < gkDBL_epsilon)
{
if(dm3*dm3 < gkDBL_epsilon)
{...
Note. There's still a numerical limit to hit if you make things small
enough. In fact, in the very corners of each triangle it's probably
still tripped sometimes for the conditionals above; We just can't see it.
Bill P.
Post a reply to this message
|
|