Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: fix heightmap orientation, black is low and white is high #170

Closed
wants to merge 1 commit into from

Conversation

illwieckz
Copy link
Member

issue found while experimenting with xonotic assets in #159, see also #30, especially #30 (comment)

there is only one heightmap standard: black is low and white is high

xreal was doing white is low and black is high for heightmap in alpha channel of normal map but was doing black is low and white is high for heightmap in loose file which does not make sense

in any way daemon seems to have been forked before the addition of shader keywords to support heightmap loose file so only heightmap in alpha channel is supported at this point

@illwieckz illwieckz changed the title fix parallax orientation, black is low and white is high fix heightmap orientation, black is low and white is high Feb 27, 2019
there is only one heightmap standard: black is
low and white is high

xreal was doing white is low and black is high
for heightmap in alpha channel of normal map
but was doing black is low and white is high
for heightmap in loose file which does not
make sense

in any way daemon seems to have been forked
before the addition of shader keywords to
support heightmap loose file so only heightmap
in alpha channel is supported at this point
@slipher
Copy link
Member

slipher commented Feb 27, 2019

Maybe it's not so simple. You can see here some sort of binary search on the heightmap values, which means you would not get the same result after reversing the depth scale and inverting the image. I can't tell which convention it is intended to use.

@illwieckz
Copy link
Member Author

illwieckz commented Feb 28, 2019

Yay, maybe, I tried to import similar code straight from ioquake3's renderergl2 instead and it renders the good way without to invert stuff. It also fixed a second bug for free. Will push code later.

Btw there is still another bug that is not fixed yet (or maybe two if I'm wrong by assuming two weirdness I see come from the same bug), but there is maybe more parallax code I can pick…

@illwieckz
Copy link
Member Author

I'm wrong, even renderergl2's code is wrong if used properly, the problem seems to have something to do with SWIZ.

@illwieckz illwieckz changed the title fix heightmap orientation, black is low and white is high WIP: fix heightmap orientation, black is low and white is high Mar 3, 2019
@illwieckz
Copy link
Member Author

I'm closing it, parallax needs far more work than a scaling inversion, and perhaps a rework will just fix the issues by doing things right by working on causes instead of reverting bad results.

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

Successfully merging this pull request may close these issues.

2 participants