Safari 14, Shadertoy and WebGL 2

This is a quick post thrown togeth­er to report on my expe­ri­ence with the new Safari 14 regard­ing sup­port for WebGL 2. The news of improved WebGL sup­port was float­ed last month in the Shader­toy Com­mu­ni­ty Group:Fast for­ward to today and the Safari 14 update has now come to my lap­top (which still runs macOS Mojave). So the first thing I did check out all my shaders on Shader­toy and then some to see if the promis­es were true. My ver­dict (TL/DR):

Con­tin­ue read­ing

Sorting through comment spam is burdensome

In order to keep this site spam free I approve every com­ment by hand. This means that com­ments will not imme­di­ate­ly appear after post­ing.

Unfor­tu­nate­ly, com­ments tend to appear in bursts. There can be long stretch­es of no activ­i­ty (where I get noth­ing but spam), dur­ing which I will get lazy and will tend to check less and less often, only to be sur­prised when there are mul­ti­ple legit com­ments wait­ing (usu­al­ly after a link has been post­ed to social media).

So if you think your post got stuck just try again.

Correct sRGB Dithering

This is a brain-dump inspired by a thread on twit­ter about cor­rect™ dither in sRGB, mean­ing, to choose the dither pat­tern in such a way as to pre­serve the phys­i­cal bright­ness of the orig­i­nal pix­els. This is in prin­ci­ple a solved prob­lem, but the dev­il is in the details that are eas­i­ly over­looked, espe­cial­ly when dither­ing to only a few quan­ti­za­tion lev­els.

So, this top­ic came up on twit­ter:

I had pre­vi­ous­ly spent some time to wrap my head around this exact prob­lem, so I shot from the hip with some pseu­do code that I used in Space Glid­er on Shader­toy. Code post­ings on twit­ter are nev­er a good idea, so here is a cleaned up ver­sion wrapped up in a prop­er func­tion:

Con­tin­ue read­ing

Update of my 2013 FMX Slides on Physically Based Shading in PDF format

The slides of my 2013 talk at FMX in Stuttgart were avail­able for down­load for a long time now in both Keynote and Pow­er­point for­mats. How­ev­er, peo­ple keep ask­ing for a PDF ver­sion. As I wrote in the com­ments once, I always had bad luck with the PDF export from Keynote, so I left it at that.

Yes­ter­day I made a major dis­cov­ery: The option “export to PDF” is not the only pos­si­bil­i­ty, in fact, it is quite an infe­ri­or one. The thing that I over­looked is that one can also just pre­tend to “print”, and then, in the sub­se­quent print­er dia­log, chose “save to PDF” instead. Not only does this give addi­tion­al options but also pro­duces nicer for­mat­ting and a small­er file!

I won­der how­ev­er the UI design­ers at Apple real­ly intend­ed this to be the pri­ma­ry means of PDF export? 

Any­way, I updat­ed the slides to PDF for­mat and also made some minor cor­rec­tions. I exchanged the font Human­ist 521 with Gill Sans. Appar­ent­ly the for­mer is an offi­cial clone of the lat­ter, and since Gill Sans is pre­in­stalled on a Mac any­way, I may as well just use the orig­i­nal. The met­rics also seem to look nicer in the PDF. I also copy-edit­ed some of the notes to be more edu­ca­tion­al than just a tran­script of my talk.

Here is again, the direct down­load link.

Down­load “FMX 2013 Slides PDF with Notes” fmx-11-revised.pdf – Down­loaded 1479 times – 15 MB

Followup to Atmospheric Scattering—Part 1: Overview

This post is the first in a series to fol­low-​up on my 2012 GPU Pro 3 arti­cle about atmos­pher­ic scat­ter­ing [11]. What I showed there was a full sin­gle-​scat­ter­ing solu­tion for a plan­e­tary atmos­phere run­ning in a pix­el shad­er, dynam­ic and in real time, with­out pre-​com­pu­ta­tion or sim­pli­fy­ing assump­tions. The key to this achieve­ment was a nov­el and effi­cient way to eval­u­ate the Chap­man func­tion [2], hence the title. In the time since then I have improved on the algo­rithm and extend­ed it to include aspects of mul­ti­ple scat­ter­ing. The lat­ter caus­es hor­i­zon­tal dif­fu­sion (twi­light sit­u­a­tions) and ver­ti­cal dif­fu­sion (deep atmos­pheres), and nei­ther can be ignored for a gen­er­al atmos­phere ren­der­er in a space game, for exam­ple.

I have writ­ten a Shader­toy that reflects the cur­rent state of affairs. It’s a mini flight sim­u­la­tor that also fea­tures clouds, and oth­er ren­der­ing good­ies. A WebGL 2 capa­ble brows­er is need­ed to run it. Under Win­dows, the ANGLE/Direct 3D trans­la­tor may take a long time to com­pile it (up to a minute is noth­ing unusu­al, but it runs fast after­wards). When suc­cess­ful­ly com­piled it should look like this:
Con­tin­ue read­ing

Most Popular Posts and Tags

I have added a per­ma­nent page with a sum­ma­ry of the most pop­u­lar posts on this blog. I also tried to add mean­ing­ful tags to all posts. Here are the most impor­tant tags:

Content type tags

  • down­load — a down­load is avail­able is this post
  • gem — a code snip­pet or oth­er copy-paste thing is avail­able
  • math — posts that are heavy on math for­mu­lae

Topic tags

So, where are the stars?

In my pre­vi­ous rant about dynam­ic expo­sure in Elite Dan­ger­ous (which hon­est­ly applies to any oth­er space game made to date), I made a rough cal­cu­la­tion to pre­dict the bright­ness of stars as they should real­is­ti­cal­ly appear in pho­tos tak­en in out­er space. My pre­dic­tion was, that,

  • for an illu­mi­na­tion of sim­i­lar strength to that on earth,
  • if the sun­lit parts are prop­er­ly exposed,
  • and with an angu­lar res­o­lu­tion of about 2 arc min­utes per pix­el,

then the pix­el-val­ue of a promi­nent star should be in the order of 1 to 3 (out of 255, in 8‑bit sRGB encod­ing). Since then I was curi­ous to find some real world val­i­da­tion for that fact, and it seems I have now found it.


Con­tin­ue read­ing


The ‘mod­ern’ look­ing sans-serif font I use recent­ly in \text{\LaTeX} equa­tions on this blog is called ‘Com­put­er Mod­ern Bright’, and actu­al­ly is not so mod­ern at all: Designed by Wal­ter Schmidt in 1996, it is still to date the only free sans-serif font avail­able for \text{\LaTeX} with full math sup­port. Type‑1 ver­sions of this font are avail­able in the cm-super pack­age, but I did­n’t need to install any­thing, because appar­ent­ly, the Quick­La­TeX Word­Press plu­g­in has them already. The only thing to do was adding just one line to the pre­am­ble:

\usepackage{cmbright}   % computer modern bright

I also turned on the SVG images fea­ture that was added with ver­sion 3.8 of Quick­La­tex, so the equa­tions are no longer pixel­lat­ed on reti­na dis­plays or when zoom­ing in! Neat, huh?