Skip to content

Non-power-of-two textures in software renderer #578

Description

@Ezandora

When using Aleph One's software renderer in Marathon 1's scenario, the blue/white texture in "Shake Before Using..." does not render the same as the original game, causing a misaligned zigzag-like pattern. But, only when it's a floor or ceiling - walls are accurate.

Marathon 1 Original:
Image

Aleph One software rendering:
Aleph One Software

Renders correctly in Aleph One's OpenGL rendering:
Image

OpenGL is default so most people will never see this bug.

This is because that texture has a size of 129x130, with a bytes per row of 130 - it's not a standard 128x128. Aleph One's renderer is from Marathon 2, and it expects a power-of-two texture. There's another texture from that set that's 129x128, with a bytes per row of 128, but I do not know if it renders correctly on the floor/ceiling.

Here's the texture in the Marathon 2 engine, as suggested by treellama:
Marathon 2 texture port
It does indeed render the exact same buggy way, since A1's renderer is a slightly extended version of M2's.

I imagine M1's renderer must have been more permissive, and someone at Bungie didn't crop the texture properly.

Fixing it might require a separate code path in texture_horizontal_polygon_lines() (low_level_textures.h) and maybe _pretexture_horizontal_polygon_lines() (scottish_textures.cpp), specifically when rendering a non-POW2 textures. The math here is arcane and old so that might not be terribly easy.

texture_vertical_polygon_lines() (low_level_textures.h) renders this texture correctly on the walls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions