Better HN
topnewbestaskshowjobs
Log inSign up

johnnovak

313 karma · joined Mar 13, 2016 (10y ago) · 45 submissions

http://www.johnnovak.net/
Submissions

comment 5y ago · link · parent

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.

2.

Nim Apocrypha, Vol. I(blog.johnnovak.net ↗)

2 points · by johnnovak · 5y ago · 2 comments

3.

Ao Resists the Forces of Darkness (pbrt Meets Nim)(blog.johnnovak.net ↗)

3 points · by johnnovak · 9y ago · discuss

4.

Nim performance tuning for the uninitiated(blog.johnnovak.net ↗)

8 points · by johnnovak · 9y ago · discuss

5.

A minimalist Openbox desktop for Vim freaks(blog.johnnovak.net ↗)

6 points · by johnnovak · 10y ago · discuss

6.

Cross-Platform GUI Toolkit Trainwreck, 2016 Edition(blog.johnnovak.net ↗)

2 points · by johnnovak · 10y ago · discuss

7.

The Nim Ray Tracer Project – Part 4: Calculating Box Normals(blog.johnnovak.net ↗)

6 points · by johnnovak · 10y ago · discuss

8.

The Nim Ray Tracer Project – Part 3: Lighting and Vector Maths(blog.johnnovak.net ↗)

2 points · by johnnovak · 10y ago · discuss

comment 10y ago · link · parent

Not divide by two; you have to use the gamma transfer curve.

comment 10y ago · link · parent

Looks like you missed all the other artifacts I gave examples for, which are all calibration independent (colour blending, compositing, rendering etc.)

comment 10y ago · link · parent

More even = an even gradation from black to white.

comment 10y ago · link · parent

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.)

comment 10y ago · link · parent

Care to elaborate on the technical inaccuracies you spotted in the article? I would like to correct them, that's why I'm asking.

comment 10y ago · link · parent

Thanks for the suggestion, I'll look into the scrset thing!

comment 10y ago · link · parent

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.

comment 10y ago · link · parent

Instant upvote :)

comment 10y ago · link · parent

Cheers, corrected!

comment 10y ago · link · parent

That PDF looks excellent, thanks! I will link to it in the further reading section.

comment 10y ago · link · parent

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.

comment 10y ago · link · parent

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.

comment 10y ago · link · parent

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.

comment 10y ago · link · parent

It's wrong in CS6, and that the only version of Photoshop I could test it with.

comment 10y ago · link · parent

Thanks, good catch! No matter how many times I proofread my writings, some of these errors always slip through...

comment 10y ago · link · parent

You need to calibrate your monitor then.

comment 10y ago · link · parent

Ah, the title again... I'll promise I'll choose my title more carefully next time, so many people are hung up on this...

comment 10y ago · link · parent

Thanks for that, I'll fix it later today!

comment 10y ago · link · parent

It's not an opinion, check the references section for further info.

comment 10y ago · link · parent

It's always refreshing to meet people who never make spelling errors! :) Other than that, try calibrating your monitor!

comment 10y ago · link · parent

It's most likely an iPad thing. Try viewing it on a real desktop monitor!

comment 10y ago · link · parent

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...

12