Coder Social home page Coder Social logo

Comments (5)

bcamper avatar bcamper commented on August 11, 2024

@zerebubuth and @blair1618 should confirm that this is what we discussed to make sure I remembered properly :) (And same for normals maps, assume in different issue)

from joerd.

zerebubuth avatar zerebubuth commented on August 11, 2024

I've updated the title of this, as I was confused: When I read "16-bit PNG" the first thing I think of is 16-bit channels, but that wasn't what was meant.

Additionally: We discussed using 2 channels for the moment, but leaving the 3rd as a fractional channel for future use. It turns out that NED has fractional heights, so we can start using that now. I propose that we do the following:

uheight = height + 16384.0
[r, g, b] = [int(uheight) >> 8, int(uheight) & 255, int(frac(uheight) * 256]

Does that sound like it'll work well enough, shader-side?

from joerd.

bcamper avatar bcamper commented on August 11, 2024

Yes, sounds good. So it's 24-bits of precision, in a fixed-point 16.8 format (16 bits of integer, 8 bits of fraction).

from joerd.

matteblair avatar matteblair commented on August 11, 2024

Yeah, makes sense to me!

float height = (texel.r * 256.0 + texel.g + texel.b / 256.0) - 16384.0;

from joerd.

zerebubuth avatar zerebubuth commented on August 11, 2024

Oops, that should have been:

uheight = height + 32768

Although I'm not sure it would have mattered; Challenger Deep is only 10,916m, so we've got a bit to spare 😉

from joerd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.