Texture: Fix edge case bug in adjust_blur (#2052)
Texture: Fix edge case bug in adjust_blur (#2052)

Mea culpa. Ramon Montoya alerted me to a problem in 2013 and I either
forgot about it, ignored it, or failed to understand it. But I
rediscovered his email while trying to purge my inbox of long-ago
unresponded emails and decided to look into it again.

The problem situation is that we figure out the filter ellipse based on
the derivatives, and then "thicken" it based on the amount of blur
requested.  Ramon pointed out that a very uneven amount of blur (very
different in s and t) could thicken the minor axis so much more than the
major axis that, you know, they aren't the proper axes any more. And
that could lead to odd behavior later on, because the samples are laid
out along the major axis and assuming in all the math that majorlegnth
>= minorlength.

I tried a few approaches, and the most streightforward was just to
notice when this happens, and swap the minor/major (rotating the ellipse
by PI/2).  This seems to basically work and looks quite good for the
common situations, although it's less than satisfactory for the
combination of very uneven blurs and extreme sheer that you get when the
ds and dt derivatives are nearly colinear (pointed in almost the same
direction or almost opposite, instead of the more typical and expected
nearly-perpendicular configuration). Though maybe it's right then, too,
I dunno, it's very hard to reason about what's "right" in that weird case.

That fix is 3 lines of code in adjust_blur().

The rest of the PR is comments trying to explain what works and doesn't,
and various improvements to the unit test visualizations (including
adding the ability to turn them on and control the amount of blur from
the env OPENIMAGEIO_TEXTURE_OPTIONS, drawing the ellipse axes, and drawing
the individual sample footprints in the visualization).

All my testsuite passes. Lookups should all be identical except for that
problem case -- certain situations of VERY uneven s and t blur amounts --
and in that case it's possible that you might have renders change the
appearance slightly.
OpenImageIO/oiio,lgritz/oiio,OpenImageIO/oiio,lgritz/oiio,OpenImageIO/oiio,lgritz/oiio,lgritz/oiio,OpenImageIO/oiio