Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Floating point images have been something I've been waiting for for awhile.

For a game engine I'm working on, I need floating point textures to represent emissivity (how much light an object might reflect...anything greater than 1.0 means the object is generating its own light, think a neon sign).

Without the ability to draw floating point textures, I've been limited to using regular 8-bit monochrome (which maps 0-255 to 0.0-1.0 in the engine), and having a special "multiplier" pixel in the corner of the image, used for multiplying the 0.0-1.0 value, so I can have, for example, emissivity of 3.0.

Floating point images eliminate the need for all of this :)




how does it compare in size though? why can't you use an image with 3 channels instead to achieve the same goal (avoiding inaccuracies)?


Yeah, Arelius pointed out that the single channel float textures are 4 times bigger than a single channel signed byte texture. I think the convenience of using a float image in gimp though, is that I can easily draw the levels that I want in the texture in a single channel, vs trying to draw the levels in multiple channels.


Could an alpha layer be used for this purpose?


You could but it would waste space. In my setup, I only need a single pixel to serve as the multiplier, but if I added a whole new layer, that's width x height more pixels.


Do keep in mind that a floating point buffer is 4 times the size of a normal buffer.

And an alpha mask can be gray scale, or even one-bit color.

Not that this couldn't be a good use of floating point textures for other reasons (A full HDR pipeline for example) But it sounds that using floating point textures is actually the real waste of space.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: