Slides of my FMX 2013 presentation on Physically Based Shading

I was kindly invited by Wolf­gang from Con­fetti FX to speak at the FMX 2013 con­fer­ence about phys­i­cally based shad­ing (within the scope of the Real Time Ren­der­ing day). Since I remem­bered the FMX as a con­fer­ence for visual arts, I made the pre­sen­ta­tion inten­tion­ally non-​technical, 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 included). The Keynote for­mat is the orig­i­nal and the Pow­er­point for­mat was exported from that and is a lit­tle bro­ken, so you should use the Keynote ver­sion if you can read it.

FMX2013 (Keynote for­mat) (547)
FMX2013 (Pow­er­point for­mat) (981)

Followup: Normal Mapping Without Precomputed Tangents

This post is a follow-​up to my 2006 ShaderX5 arti­cle [4] about nor­mal map­ping with­out a pre-​computed 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 topic, the moti­va­tion was to con­struct the tan­gent frame on the fly in the pixel shader, which iron­i­cally 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­ity of asset tools, per-​vertex band­width and stor­age, attribute inter­po­la­tors, trans­form work for skinned meshes and last but not least, the pos­si­bil­ity to apply nor­mal maps to any pro­ce­du­rally gen­er­ated tex­ture coor­di­nates or non-​linear defor­ma­tions. Con­tinue read­ing

Velvet Assassin on Mac (Patch)

I just got news that Vel­vet Assas­sin has been ported over to the Mac and is avail­able on the App Store! (It is that game for which I wrote about half of the engine code and the shad­ing model.) How­ever, I was not at all involved in the Mac port and I don’t know the devel­op­ers who did — it came as a sur­prise to me as to any­one else in the for­mer team. Here is a direct iTunes link: http://itunes.apple.com/app/id586878367.

Shader Bug on ATI graphic cards

Unfor­tu­nately there is a shader bug with ATI graph­ics chips. It hap­pened to me while try­ing it out on a 2011 iMac with an ATI Radeon HD 5670. I got reports from friends that this is not a prob­lem of the Mac port itself but it hap­pens on PC too. The prob­lem is related to ATI chips with dri­vers that are newer than 2010 or so. Here is a screenshot:

Screen shot 2013-01-11 at 04.09.06

Con­tinue read­ing

FlipCode is back

Kurt has taken steps to revive Flip­Code.

Flip­code was a place to dis­cuss gamedev + algo­rithms with a unique flair and an out­stand­ing audi­ence, some­thing IMHO gamedev.net never matched. I, too, was a reg­u­lar vis­i­tor, poster, and also con­tributed the odd arti­cle and an IOTD. Ter­rain engines bor­der­ing on 100k polys with­out HW T&L will be for­ever in the past, but the spirit will live on.

Branchless Matrix to Quaternion Conversion

A rou­tine to con­vert a matrix to a quater­nion was given by Ken Shoe­make [1], and seems to have been accepted as a ‘fact of life’. The code is orga­nized around a switch of four branches, depend­ing on the sign of the diag­o­nal matrix ele­ments. Is it pos­si­ble to do the con­ver­sion entirely with­out branches? No, not in gen­eral, if you must pro­tect against any and all sin­gu­lar­i­ties. Is it pos­si­ble, then, to expand the singularity-​free domain of a branch­less ver­sion so it cov­ers a use­ful range? Well yes, that’s what this post is about. Con­tinue read­ing

OpenGL 4.3

I just got the news about the OpenGL 4.3 spec, which was released today, and is avail­able at http://www.opengl.org/registry/. The spec doc­u­ment has been reor­ga­nized and cleared up con­sid­er­ably and is a lot eas­ier to fol­low than the pre­vi­ous spec­i­fi­ca­tions. New fea­tures include (ordered by impor­tance for my projects):

  • Queries for inter­nal tex­ture for­mat parameters
  • Debug out­put callbacks
  • Com­pute shaders
  • Tex­ture views
  • and oth­ers

I’m cur­rently on a project where com­pat­i­bil­ity and scaleabil­ity is prime, so the first two fea­tures are very wel­come as devel­op­ment aids to make the code run robustly on a vari­ety of plat­forms. Com­pute shaders and tex­ture views are of course cool, but require the newest hard­ware, so they are lower in my list.

A nice touch by Nvidia to make to expose the new func­tion­al­ity as exten­sions on older hard­ware.

Cloud rendering and the relativity of whiteness

Here are some philo­soph­i­cal and rendering-​related ques­tions that I took home from the last vacation. What’s the color of clouds? The stan­dard answer would be, white.
What’s the color 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­eral area on which the bright­ness dif­fer­ence between clouds vs snow is even more pronounced. If you look at the directly lit parts of the snow and con­sider it white (#ffffff), then the directly lit parts of the clouds are at most 50% grey (#bbbbbb). Is that an evi­dence of air pol­lu­tion? Unlikely! (At least not in Tyrol).

Con­tinue read­ing

GPU Pro 3 has arrived

I found my copy of the book in the mail today. I was a lit­tle sur­prised by the mod­er­ate size — other vol­umes of this series were just that: vol­umes! I think this one is about half the size than the pre­vi­ous tomes. By the way, this post is a shame­less plug because there is an arti­cle writ­ten by me in it. Thanks go to Wolf­gang, the series edi­tor, and Christo­pher, my sec­tion edi­tor, and all the folks at CRC press for mak­ing this pos­si­ble (again)! I will post some com­ments on the other arti­cles when I read them through.

Edit:
I found one very good and com­pre­hen­sive arti­cle on data dri­ven engine design by Don­ald Revie. The ideas pre­sented in there res­onate very well with the designs that I found worked well in the past, so this part gets a solid +1 from me.

(I ended up with a triad of IRen­der­Ob­ject, IRen­der­Ge­om­e­try and IRen­der­Pro­gram, where the ren­der object would AddBatches() to a draw list, each of which refers to one geom­e­try con­tain­ing the mesh and one pro­gram for set­ting the ren­der state. For instance, a SpeedTree™ ren­der object would typ­i­cally add three batches, one for each of the branches, fronds and leaves, where each batch would pair the spe­cific geom­e­try with an appro­pri­ate pro­gram. The draw list is then sorted in one go via a gen­eral 128 bit sort key, and the batches ren­dered in order. This sys­tem is gen­eral enough that the UI sys­tem also can just AddBatches() to this list (so the UI sys­tem, as a whole, is just one instance of a ren­der object). In this case, the indi­vid­ual UI geom­e­try objects just rep­re­sent views into one big dynamic ver­tex buffer. I prob­a­bly want to explain this sys­tem in detail in another post.)

Another two very inspir­ing arti­cles so far are the one about geo­met­ric post­process antialias­ing, by Emil “Humus” Pers­son, and the piece about global illu­mi­na­tion using a voxel grid, from the teams at the Unis Koblenz/​Magdeburg. I already read their ACM paper before and I think it is a viable method.

Various Mac tricks

This is my per­sonal 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 hid­den files in Finder

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

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

Delete all .DS_​Store files

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

If hid­den files are enabled in the finder, 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.

Pre­vent .DS_​Store files on net­work mounts

> defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Although there is no method to gen­er­ally 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].

Dis­able Spot­light index­ing 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 later, it also deletes any par­tial index cre­ated up to this point. There is one caveat: The enable/​disable infor­ma­tion is itself stored inside the “.Spotlight-​V100” direc­tory, so do not delete that, and be care­ful when back­ing up to another drive. 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 fold­ers”,
http://kb.mozillazine.org/Show_hidden_files_and_folders

[3] Apple Sup­port, “Mac OS X v10.4 and later: How to pre­vent .DS_​Store file cre­ation over net­work con­nec­tions”,
http://support.apple.com/kb/HT1629

ShaderX is searched by EPO

While googling the net, I found this remark­able piece. This is a patent appli­ca­tion from 2010, and from the draw­ings, it seems that the inven­tor had the ‘rev­o­lu­tion­ary’ idea of cal­cu­lat­ing some adap­tive depth bias based on the depth map to improve shadow mapping.

The note­wor­thy part of the story is, that the offi­cial research, the patent clerk appar­ently turned up my ShaderX4 arti­cle from 2006, as can be seen here fur­ther down on the page. The page also states that the appli­ca­tion has been aban­doned. So, maybe the exis­tence of this arti­cle has pre­vented a patent on shadow maps, or at least dis­cour­aged the issuer to pur­sue the appli­ca­tion. In either case, let’s hope it stays that way!

We can draw two con­clu­sions from this.

  • Con­clu­sion 1: ShaderX seems to be rec­og­nized by the EPO as a source of state of the art.
  • Con­clu­sion 2: If you have an idea, write about and pub­lish it! It doesn’t mat­ter if it is just a blog post. If it can be tracked down, this can pre­vent a patent on the same idea in the future!