Skip to content

fix ImageBasedTexture - #159

Merged
unhyperbolic merged 1 commit into
3-manifolds:masterfrom
alejo7797:fix-eye
Oct 26, 2026
Merged

unhyperbolic merged 1 commit into
3-manifolds:masterfrom
alejo7797:fix-eye

Conversation

@alejo7797

Copy link
Copy Markdown
Contributor

This change fixes an issue with loading PNG files in ImageBasedTexture.

png.Reader.asRGBA8() got removed from pypng: https://gitlab.com/drj11/pypng/-/commit/85479eaf5d6152afcfc4d0f3de4188a2174bdf8a This commit hasn't made it to the pypng wheel on PyPI (still at version 0.20220715.0) which is why I assume maybe it's hard to run into.

But the removal is present in this release (version 0.20250521.0) which is what distributions seem to be packaging (Debian, Arch Linux and Nixpkgs at least).

This causes the following:

In[1]: M = Manifold('4_1')

In[2]: M.inside_view()
Warning could not read texture {{prefix}}/lib/python3.14/site-packages/snappy/raytracing/shaders/NonGeometric.png
'Reader' object has no attribute 'asRGBA8'
Warning could not read texture {{prefix}}/lib/python3.14/site-packages/snappy/raytracing/shaders/Eye.png
'Reader' object has no attribute 'asRGBA8'

Out[2]: New window: Inside view of 4_1

and the eyeball texture not to render when selected:

image

So I replaced the call to .asRGBA8() with one to .asRGBA() and added a check that the bitdepth of the PNG texture file is 8. This is the case for Eye.png andNonGeometric.png, which from what I can tell are the only PNG texture files used within SnapPy.

Happy eyeballs:

image

png.Reader.asRGBA8() got removed from pypng:
https://gitlab.com/drj11/pypng/-/commit/85479eaf5d6152afcfc4d0f3de4188a2174bdf8a

Eye.png and NonGeometric.png both have bitdepth 8 so .asRGBA() has the
same behaviour
@unhyperbolic
unhyperbolic merged commit c66a88b into 3-manifolds:master Oct 26, 2026
18 of 19 checks passed
@alejo7797
alejo7797 deleted the fix-eye branch October 26, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants