johnnovak
Re:Nim Apocrypha, Vol. I
on Monday December 21, 2020 @09:15AM (#25495099)
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.
Ao Resists the Forces of Darkness (pbrt Meets Nim)
Nim performance tuning for the uninitiated
A minimalist Openbox desktop for Vim freaks
Cross-Platform GUI Toolkit Trainwreck, 2016 Edition
The Nim Ray Tracer Project – Part 4: Calculating Box Normals
The Nim Ray Tracer Project – Part 3: Lighting and Vector Maths
Re:What every coder should know about gamma
on Thursday September 22, 2016 @06:06PM (#12560730)
Not divide by two; you have to use the gamma transfer curve.
Re:What every coder should know about gamma
on Thursday September 22, 2016 @06:03PM (#12560712)
Looks like you missed all the other artifacts I gave examples for, which are all calibration independent (colour blending, compositing, rendering etc.)
Re:What every coder should know about gamma
on Thursday September 22, 2016 @05:59PM (#12560695)
More even = an even gradation from black to white.
Re:What every coder should know about gamma
on Thursday September 22, 2016 @05:57PM (#12560684)
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.)
Re:What every coder should know about gamma
on Thursday September 22, 2016 @05:54PM (#12560662)
Care to elaborate on the technical inaccuracies you spotted in the article? I would like to correct them, that's why I'm asking.
Re:What every coder should know about gamma
on Thursday September 22, 2016 @05:50PM (#12560630)
Thanks for the suggestion, I'll look into the scrset thing!
Re:What every coder should know about gamma
on Thursday September 22, 2016 @06:12AM (#12555763)
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.
Re:What every coder should know about gamma
on Thursday September 22, 2016 @06:03AM (#12555737)
Instant upvote :)
Re:What every coder should know about gamma
on Thursday September 22, 2016 @03:24AM (#12555102)
Cheers, corrected!
Re:What every coder should know about gamma
on Thursday September 22, 2016 @03:23AM (#12555099)
That PDF looks excellent, thanks! I will link to it in the further reading section.
Re:What every coder should know about gamma
on Thursday September 22, 2016 @03:01AM (#12555011)
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.
Re:What every coder should know about gamma
on Thursday September 22, 2016 @02:54AM (#12554981)
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.
Re:What every coder should know about gamma
on Thursday September 22, 2016 @02:48AM (#12554954)
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.
Re:What every coder should know about gamma
on Thursday September 22, 2016 @02:46AM (#12554950)
It's wrong in CS6, and that the only version of Photoshop I could test it with.
Re:What every coder should know about gamma
on Wednesday September 21, 2016 @10:52PM (#12553988)
Thanks, good catch! No matter how many times I proofread my writings, some of these errors always slip through...
Re:What every coder should know about gamma
on Wednesday September 21, 2016 @10:39PM (#12553940)
You need to calibrate your monitor then.
Re:What every coder should know about gamma
on Wednesday September 21, 2016 @10:37PM (#12553929)
Ah, the title again... I'll promise I'll choose my title more carefully next time, so many people are hung up on this...
Re:What every coder should know about gamma
on Wednesday September 21, 2016 @10:35PM (#12553925)
Thanks for that, I'll fix it later today!
Re:What every coder should know about gamma
on Wednesday September 21, 2016 @10:07PM (#12553810)
It's not an opinion, check the references section for further info.
Re:What every coder should know about gamma
on Wednesday September 21, 2016 @10:06PM (#12553808)
It's always refreshing to meet people who never make spelling errors! :) Other than that, try calibrating your monitor!
Re:What every coder should know about gamma
on Wednesday September 21, 2016 @10:01PM (#12553793)
It's most likely an iPad thing. Try viewing it on a real desktop monitor!
Re:What every coder should know about gamma
on Wednesday September 21, 2016 @09:59PM (#12553784)
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...