Yes, sRGB is like µ‑law encoding

I vague­ly remem­ber some­one mak­ing a com­ment in a dis­cus­sion about sRGB, that ran along the lines of

So then, is sRGB like µ‑law encoding?

This com­ment was not about the col­or space itself but about the spe­cif­ic pix­el for­mats nowa­days brand­ed as ’sRGB’. In this case, the answer should be yes. And while the tech­ni­cal details are not exact­ly the same, that anal­o­gy with the µ‑law very much nails it.

When you think of sRGB pix­el for­mats as noth­ing but a spe­cial encod­ing, it becomes clear that using such a for­mat does not make you auto­mat­i­cal­ly “very picky of col­or repro­duc­tion”. This assump­tion was used by hard­ware ven­dors to ratio­nal­ize the deci­sion to lim­it the sup­port of sRGB pix­el for­mats to 8‑bit pre­ci­sion, because peo­ple “would nev­er want” to have sRGB sup­port for any­thing less. Not true!Screen Shot 2014-03-06 at 19.02.54I’m going to make a case for this lat­er. But first things first.

Weit­er­lesen

Slides of my FMX 2013 presentation on Physically Based Shading

Edit 2019: I have con­vert­ed the orig­i­nal slides to PDF for­mat and also made minor cor­rec­tions. See this post for details. The down­load is at the end of this page.

I was kind­ly invit­ed by Wolf­gang from Con­fet­ti FX to speak at the FMX 2013 con­fer­ence about phys­i­cal­ly based shad­ing (with­in the scope of the Real Time Ren­der­ing day). Since I remem­bered the FMX as a con­fer­ence for visu­al arts, I made the pre­sen­ta­tion inten­tion­al­ly non-tech­ni­cal, for fear of alien­at­ing the lis­ten­ers. In ret­ro­spect, my guess was a bit too con­ser­v­a­tive, as there were quite a num­ber of pro­gram­mers in the audience.

Screen Shot 2013-04-24 at 14.53.58

Nev­er­the­less, here are the slides for down­load (with all notes includ­ed). The Keynote for­mat is the orig­i­nal and the Pow­er­point for­mat was export­ed from that and is a lit­tle bro­ken, so you should use the Keynote ver­sion if you can read it.

Down­load “FMX 2013 Slides PDF with Notes” fmx-11-revised.pdf – 11793-mal herun­terge­laden – 15,25 MB

Followup: Normal Mapping Without Precomputed Tangents

This post is a fol­low-up to my 2006 ShaderX5 arti­cle [4] about nor­mal map­ping with­out a pre-com­put­ed tan­gent basis. In the time since then I have refined this tech­nique with lessons learned in real life. For those unfa­mil­iar with the top­ic, the moti­va­tion was to con­struct the tan­gent frame on the fly in the pix­el shad­er, which iron­i­cal­ly is the exact oppo­site of the moti­va­tion from [2]:

Since it is not 1997 any­more, doing the tan­gent space on-the-fly has some poten­tial ben­e­fits, such as reduced com­plex­i­ty of asset tools, per-ver­tex band­width and stor­age, attribute inter­po­la­tors, trans­form work for skinned mesh­es and last but not least, the pos­si­bil­i­ty to apply nor­mal maps to any pro­ce­du­ral­ly gen­er­at­ed tex­ture coor­di­nates or non-lin­ear defor­ma­tions. Weit­er­lesen

Branchless Matrix to Quaternion Conversion

(Edit: This arti­cle is a more in-depth write­up of an algo­rithm that I devel­oped around 2005, and first post­ed to Mar­tin Baker’s Euclid­ean Space web­site. That time was the height of the Intel Net­Burst archi­tec­ture, which was noto­ri­ous for its deep pipeline and high branch mis­pre­dic­tion penal­ty. Hence the moti­va­tion to devel­op a branch-free matrix to quater­nion con­ver­sion rou­tine. What fol­lows is the com­plete deriva­tion and analy­sis of this idea.)

The orig­i­nal rou­tine to con­vert a matrix to a quater­nion was giv­en by Ken Shoe­make [1] and is very branchy. There is a way to elim­i­nate these branch­es and arrive at a com­plete­ly branch-free and high­ly par­al­leliz­able code. The trade off is the intro­duc­tion of 3 addi­tion­al square roots. Jump to the analy­sis sec­tion and the end of this arti­cle, or con­tin­ue fist with the math bits.

Weit­er­lesen

Cloud rendering and the relativity of whiteness

Here are some philo­soph­i­cal and ren­der­ing-relat­ed ques­tions that I took home from the last vaca­tion. What’s the col­or of clouds? The stan­dard answer would be, white. What’s the col­or of snow? Again, white. Ok, then look at the fol­low­ing pic­ture, where the snow seems con­sid­er­ably whiter. This is the case in almost all pho­tos that I took.

There is an image on Wikipedia from the same gen­er­al area on which the bright­ness dif­fer­ence between clouds vs snow is even more pro­nounced. If you look at the direct­ly lit parts of the snow and con­sid­er it white (#ffffff), then the direct­ly lit parts of the clouds are at most 50% grey (#bbbbbb). Is that an evi­dence of air pol­lu­tion? Unlike­ly! (At least not in Tyrol).

Weit­er­lesen

Various Mac tricks

This is my per­son­al col­lec­tion of com­mand line tricks on Mac OS X that I found indis­pens­able. The list is far from com­plete, and may be added to in the future.

Show hidden files in Finder

> defaults write com.apple.finder AppleShowAllFiles true
> killall Finder

The first line sets the pref­er­ence for the Find­er to show hid­den files, while the sec­ond line restarts the Find­er so the set­ting comes in effect. As an alter­na­tive for the last line, select the Find­er in the Cmd-Alt-Escape pop­up and select “Relaunch”. I found this one on the Mozil­la knowl­edge base [2].

Delete all .DS_Store files

> sudo find / -name ".DS_Store" -print -delete

If hid­den files are enabled in the find­er, you will soon make con­tact with the infa­mous .DS_Store files that the desk­top ser­vice lit­ters around as you browse the filesys­tem. This is annoy­ing. Use the above com­mand to delete those suck­ers. The -print is in there just so you can mon­i­tor the progress.

Prevent .DS_Store files on network mounts

> defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Although there is no method to gen­er­al­ly stop .DS_Store files, at least you can pre­vent desk­top ser­vices from pol­lut­ing net­work mounts. Win­dows users on the same net­work will be glad! This trick is pub­lished in the Apple knowl­edge base [3].

Disable Spotlight indexing for a given volume

> sudo mdutil -i off /mountpoint

This com­mand will dis­able index­ing for the vol­ume under /mountpoint (for instance /Volumes/MyExternalHarddisk). Under MacOS X 10.5 and lat­er, it also deletes any par­tial index cre­at­ed up to this point. There is one caveat: The enable/disable infor­ma­tion is itself stored inside the .Spotlight-V100 direc­to­ry, so do not delete that, and be care­ful when back­ing up to anoth­er dri­ve. More infor­ma­tion is found in [1].


[1] The X‑Lab, “Spot­light tips”,
http://www.thexlab.com/faqs/stopspotlightindex.html

[2] Mozil­laZine, “Show hid­den files and folders”,
http://kb.mozillazine.org/Show_hidden_files_and_folders

[3] Apple Sup­port, “Mac OS X v10.4 and lat­er: How to pre­vent .DS_Store file cre­ation over net­work connections”,
http://web.archive.org/…

The Blinn-Phong Normalization Zoo

It is good to see how phys­i­cal­ly based shad­ing is final­ly gain­ing momen­tum in real time graph­ics and games. This is some­thing I have been advo­cat­ing for a long time. Devel­op­ers are spread­ing the word. I was espe­cial­ly sur­prised to learn about Call of Duty: Black Ops join­ing the club [1]. Even a slick 60 Hz shoot­er with no cycles to spare can afford to do PBS today!

This leads me to the top­ic of this post, the nor­mal­iza­tion of the Blinn-Phong spec­u­lar high­light. Why am I writ­ing about it? It came to my mind recent­ly with the cur­rent batch of pub­li­ca­tions from peo­ple adopt­ing phys­i­cal­ly based shad­ing mod­els. This got me check­ing the maths again and I com­piled a list with nor­mal­iza­tion fac­tors for dif­fer­ent shad­ing mod­els, giv­en here in this post. I would also like to elab­o­rate a lit­tle on the mod­el that I wrote about in ShaderX7 [2]. Be aware this post is a large brain dump.
Weit­er­lesen