Skip to content

Texture height being a multiple of 256 causes the model to not render (due to alpha channel becoming 0 ?) #113

Description

@sssscccc210

I found a bug where if the input texture's height (y) is a multiple of 256 (ex.: 256x256), the model completely fails to render in-game.

Estimated Cause:
In objmc.py, the texture size is encoded into the second pixel of the header:

out.putpixel((1, 0), (int(x / 256), x % 256, int(y / 256), y % 256))

When y is a multiple of 256 (like 256, 512, etc.), the alpha channel (y % 256) evaluates to 0.
(According to an Gemini, it says: Because Minecraft's texture engine optimizes fully transparent pixels by discarding their RGB data, the shader ends up reading this pixel as (0, 0, 0, 0). This causes the shader to interpret the texture size as 0x0, breaking the rendering entirely.)

Workaround:
Resizing the texture height to something like 255 (ex. 256x255) prevents the alpha from becoming 0 and works perfectly.

*The same issue might also happen with nvertices if it hits a multiple of 256 and the alpha becomes 0.

(keyword for searching: model invisible, transparent)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions