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
base: master
from

Conversation

Projects
None yet
2 participants
@illwieckz
Copy link
Member

illwieckz commented Feb 27, 2019

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

@illwieckz illwieckz force-pushed the illwieckz:fixheightmap branch from 7750781 to 589b39a Feb 27, 2019

glsl: fix heightmap orientation, black is low and white is high
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 force-pushed the illwieckz:fixheightmap branch from 589b39a to 2b2648e Feb 27, 2019

@slipher

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member Author

illwieckz commented Mar 3, 2019

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

This comment has been minimized.

Copy link
Member Author

illwieckz commented Mar 10, 2019

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.

@illwieckz illwieckz closed this Mar 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.