Sitelet https://github.com/fifengine/fifengine/issues/1058
Skip to content

Texture heightmaps for pixel perfect z ordering #1058

Description

@jmdejong

Currently when 2 images overlap one is always drawn in front of the other.
With larger, more complex or interwoven images this can look ugly and unnatural.

A solution to this could be to use texture heightmaps for pixel perfect z ordering.
Every (large) image to draw should not only get the texture itself but also the heightmap texture.
Then when OpenGL decides what pixel to draw it does not only take the z coordinate of the image, but also the value of that pixel in the heightmap image into account.

example of the effect I mean
The rest of this video has some more examples, and at the end he shows the heightmaps as well: https://youtu.be/-Q6ISVaM5Ww?t=524

I also found a (answered) gamedev stackexchange question about how to implement this:
https://gamedev.stackexchange.com/questions/59318/using-heightmap-to-simulate-3d-in-an-isometric-2d-game

This is mostly for images that are actually 2d renders of 3d objects because rendering the heightmap shouldn't be any harder than rendering the image itself

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions