HNHacker News
TopNewBestAskShowJobs

johnnovak

313 karma · joined March 13, 2016

http://www.johnnovak.net/
submissionscomments
johnnovak··on Nim Apocrypha, Vol. I
Greetings fellow Nim adventurers! Below you will find 16 handy Nim tips & tricks I came across while developing a medium-sized GUI program this year, Gridmonger (and related libraries). Some of them are about less known or undocumented Nim features or standard library functions, a few are workarounds for some rough edges of the language, and there’s also a handful of useful techniques I read about in forums or have invented on my own.
johnnovak··on What every coder should know about gamma
Not divide by two; you have to use the gamma transfer curve.
johnnovak··on What every coder should know about gamma
Looks like you missed all the other artifacts I gave examples for, which are all calibration independent (colour blending, compositing, rendering etc.)
johnnovak··on What every coder should know about gamma
More even = an even gradation from black to white.
johnnovak··on What every coder should know about gamma
If you read the article carefully, you'll realise that this is not just an optimisation (check for example the sections on colour blending and rendering; those artifacts are gamma calibration independent.)
johnnovak··on What every coder should know about gamma
Care to elaborate on the technical inaccuracies you spotted in the article? I would like to correct them, that's why I'm asking.
johnnovak··on What every coder should know about gamma
Thanks for the suggestion, I'll look into the scrset thing!
johnnovak··on What every coder should know about gamma
Yes, we need greater precision, ideally floats, but maybe 16 bits would be enough (haven't tested this or thought much about it.) But for multiple passes of processing floats are definitely the way to go due to rounding errors. I don't think you'd get worse performance when using floats on current hardware.
johnnovak··on What every coder should know about gamma
Instant upvote :)
johnnovak··on What every coder should know about gamma
Cheers, corrected!
johnnovak··on What every coder should know about gamma
That PDF looks excellent, thanks! I will link to it in the further reading section.
johnnovak··on What every coder should know about gamma
I highly doubt you perceive light intensity radically differently to your fellow humans... :) Most likely your monitor is miscalibrated.

Try a few different gamma calibration images from other sources (Google Images -> "gamma calibration") and if they consistently indicate that your monitor is miscalibrated, then you have your answer.

johnnovak··on What every coder should know about gamma
Sorry, I can't magically fix all the mobile device screens of the world so they will start displaying images in a gamma-correct way... The fact is, the owners of such devices will never see gamma correct images on their screens, at least until the manufacturers fix this. It sucks but I can't help there.

Anyway, I think you have bigger problems than gamma with those devices anyway (glare, reflections etc.), so that's probably the least of your concerns.

johnnovak··on What every coder should know about gamma
Thanks, I'm glad you enjoyed the article. The only way I could get Photoshop to resize correctly was to convert the image to 32-bit first, do the resizing, then convert back to 8/16-bit (there might other simpler ways, though, but this is guaranteed to work). The image description actually describes this process.
johnnovak··on What every coder should know about gamma
It's wrong in CS6, and that the only version of Photoshop I could test it with.
johnnovak··on What every coder should know about gamma
Thanks, good catch! No matter how many times I proofread my writings, some of these errors always slip through...
johnnovak··on What every coder should know about gamma
You need to calibrate your monitor then.
johnnovak··on What every coder should know about gamma
Ah, the title again... I'll promise I'll choose my title more carefully next time, so many people are hung up on this...
johnnovak··on What every coder should know about gamma
Thanks for that, I'll fix it later today!
johnnovak··on What every coder should know about gamma
It's not an opinion, check the references section for further info.
johnnovak··on What every coder should know about gamma
It's always refreshing to meet people who never make spelling errors! :) Other than that, try calibrating your monitor!
johnnovak··on What every coder should know about gamma
It's most likely an iPad thing. Try viewing it on a real desktop monitor!
johnnovak··on What every coder should know about gamma
I'd say scanline rendering is "more of a hack" than ray tracing, but both can produce useful looking results, of course. They are both crude approximations of reality, but ray tracing is a closer model and it makes non-local phenomena easier to model (especially if you do things in a physically-correct way, respecting the law of conservation of energy etc.) Arguably, you would end up writing a "Universe simulator" if you wanted to accurately model absolutely everything that's happening in the real world :)

By the way, I've written about this exact same topic in my initial ray tracing post:

http://blog.johnnovak.net/2016/04/28/the-nim-raytracer-proje...

johnnovak··on What every coder should know about gamma
Yeah, Nim is my favourite language currently! The expressivity and succinctness of Python with the speed of C, plus useful metaprogramming constructs. I recommend everyone to give it a go!
johnnovak··on What every coder should know about gamma
Sorry if you found the title condescending. In the intro section I also admit that I was ignorant about the whole gamma topic a few weeks ago. But I think it's an important topic, hence the title. Of course, 10 different people have 10 different opinions about what other people "should know". But this is a personal blog, and this is my personal opinion :) I guess you can't please everyone.
johnnovak··on What every coder should know about gamma
Thanks man, I'm a bit obsessed with these things and have spent way too much time on it. I'm glad someone notices and appreciates these details! :)
johnnovak··on What every coder should know about gamma
My bad, I'm not really using Linux. I'll update the article, thanks! :)
johnnovak··on What every coder should know about gamma
As arguably vision is the most important sensory channel in human-computer interaction, I'd say it doesn't hurt for all coders to have at least a vague understanding of gamma. I think it should be part of the "basic education". Of course, it's just my opinion :)
johnnovak··on What every coder should know about gamma
I'm glad you enjoyed reading the article. I completely agree on not really having a "right" way to blend gradients. For that reason I almost ended up omitting the gradient example from the article because doing it "correctly" in linear space does not always yield the most pleasant looking results. Generating perceptually fine looking gradients is another huge (and very interesting!) topic in itself, so maybe I'll discuss that in another post in the future.

Until then, have a look at this online gradient generator tools that can use five different algorithms (there's some explanation provided as well for each method):

http://davidjohnstone.net/pages/lch-lab-colour-gradient-pick...

I also recommend reading the superb 'Subtleties of Color' NASA article series on the matter:

http://earthobservatory.nasa.gov/blogs/elegantfigures/2013/0...

PS: I'm slightly confused about your comment on the black to white gradient though. Are you saying the gradient on Figure 1 looks more even to you than on Figure 2? In that case, I think your monitor is miscalibrated, so try gamma-calibrating it first then have another look. Your opinion might change :)

johnnovak··on What every coder should know about gamma
That's some very good info and it explains why the checkerboard pattern example looks completely off on all phones!
Page 1 of 2Next →