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

As game dev, i never understood why floats are used to present colors? Isn't integers better? The issues which this article mentioned wouldn't exist.

I can only think its due integers having undefined behavior what happens on overflow, usually its wrapping but not always.

 help



It is because light(colors) is a fundamentally exponential process and floats are also a fundamentally exponential process and as such the two are a good match for one another.

Floats are better for calculating lighting. I would think some GPUs are probably also more optimized for float processing than ints.



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

Search: