Smallest mipmap is black

Skip to first unread message

Etienne Sandré-Chardonnal

Feb 19, 2020, 8:11:23 AM2/19/20

I have an issue with a specific texture, which is a jpeg black&white cow skin pattern.

Usually, when differentials become large, texture lookups return the smallest mipmap color, which is the average texture color.

With this specific texture, the corresponding lookups are black instead of grey. I have tried rendering a scene with the texture, it looks fine. If I multiply the uv differentials by some factor, the pattern becomes blurry as expected. If I further increase the factor, the result is black, whereas with other textures it converges to the average color.

I attached the corresponding texture. I'm using OIIO 2.1.10 and OSL 1.11.3

Did anyone have a similar issue?



Larry Gritz

Feb 19, 2020, 1:29:06 PM2/19/20
to OSL Developers List
I can repro!

How strange! I will investigate.

I think there may be something weird going on with the filtering. In particular, I think that at the 3x3 level when it resizes to 1x1, the default filter shape has zeroes that precisely line up with the neighbouring pixel centers, so it is effectively point-sampling the center pixel of the 3x3 level to yield the one value of the 1x1 pixel.

I can get better results with

    maketx cow.jpg --resize -o cow.tx

The --resize starts by resizing the top level to a power-of-2 (your texture is 980x980), thus guaranteeing avoidance of a 3x3 level. Maybe this is an adequate workaround while I try to figure out exactly what's going wrong with the mip-to-mip resizes and what to do about it.
Larry Gritz

Reply all
Reply to author
0 new messages