I made a GLSL shader compile as C++ to see if I can profile it on a CPU and I partially suceeded. I was able look at the generated assembly at least.
But making it actually run so I could profile would be too much work. I'd have to implement all the texture() functions and stuff like dFdx()/dFdy().
If anyone deeply understood what I just said, feel encouraged to say hi! I could use some company. I feel like I'm the only person doing commercial game development with OpenGL 3.
A week ago was the 1st anniversary of this solo instance & more generally of my fulltime move to Mastodon. A good time for a more detailed intro, partially intended as CV thread (pinned to my profile) which I will add to over time (also to compensate the ongoing lack of a proper website)... Always open to consulting offers, commissions and/or suitable remote positions...
Hi, I'm Karsten 👋 — indy software engineer, researcher, #OpenSource author of hundreds of projects (since ~1999), computational/generative artist/designer, landscape photographer, lecturer, outdoor enthusiast, on the ND spectrum. Main interest in transdisplinary research, tool making, exploring techniques, projects & roles amplifying the creative, educational, expressive and inspirational potential of (personal) computation, code as material, combining this with generative techniques of all forms (quite different to what is now called and implied by "generative AI").
Much of my own practice & philosophy is about #BottomUpDesign, interconnectedness, simplicity and composability as key enablers of emergent effects (also in terms of workflow & tool/system design). Been adopting a round-robin approach to cross-pollinate my work & learning, spending periods going deep into various fields to build up and combine experience in (A-Z order): API design, audio/DSP, baremetal (mainly STM32), computer vision/image processing, compiler/DSL/VM impl, databases/linked data/query engines, data structures impl, dataviz, fabrication (3DP, CNC, knit, lasercut), file formats & protocols (as connective tissue), "fullstack" webdev (front/back/AWS), generative & evolutionary algorithms/art/design/aesthetics/music, geometry/graphics, parsers, renderers, simulation (agents/CFD/particles/physics), shaders, typography, UI/UX/IxD...
Since 2018 my main endeavor has been https://thi.ng/umbrella, a "jurassic" (as it's been called) monorepo of ~185 code libraries, addressing many of the above topics (plus ~150 examples to illustrate usage). More generally, for the past decade my OSS work has been focused on #TypeScript, #C, #Zig, #WebAssembly, #Clojure, #ClojureScript, #GLSL, #OpenCL, #Forth, #Houdini/#VEX. Earlier on, mainly Java (~15 years, since 1996).
Formative years in the deep end of the #Atari 8bit demoscene (Chip Special Software) & game dev (eg. The Brundles, 1993), B&W dark room lab (since age 10), music production/studio (from 1993-2003), studied media informatics, moved to London initially as web dev, game dev (Shockwave 3D, ActionScript), interaction designer, information architect. Branched out, more varied clients/roles/community for my growing collection of computational design tools, which I've been continously expanding/updating for the past 20+ years, and which have been the backbone of 99% of my work since ~2006 (and which helped countless artists/designers/students/studios/startups). Creator of thi.ng (since 2011), toxiclibs (2006-2013), both large-scale, multi-faceted library collections. Early contributor to Processing (2003-2005, pieces of core graphics API).
Worked on dozens of interactive installations/exhibitions, public spaces & mediafacades (own projects and many collabs, several award winning), large-scale print on-demand projects (>250k unique outputs), was instrumental in creating some of the first generative brand identity systems (incl. cloud infrastructure & asset management pipelines), collaborated with architects, artists, agencies, hardware engineers, had my work shown at major galleries/museums worldwide, taught 60+ workshops at universities, institutions and companies (mainly in EMEA). Was algorithm design lead at Nike's research group for 5 years, working on novel internal design tools, workflows, methods of make, product design (footwear & apparel) and team training. After 23 years in London, my family decided on a lifestyle change and so currently based in the beautiful Allgäu region in Southern Germany.
We are having a Bonzomatic shader jam on Monday! 8pm GMT, https://twitch.tv/FieldFxDemo now is your chance to practice in preparation for @inercia ! Get in touch if you'd like to jam with us! #demoscene#livecode#glsl
So, back in august I already noticed issues with #Intel chips because of their older #GLSL version. The culprit was this bit (simplified):
for(int i = 0; i < NUM_SHADOW_CASCADES; i++)
CalculateShadow(_shadowMap[i]);
_shadowMap is a so-called texture sampler. GLSL 3.30 does not allow indexing texture samplers with non-constant values, so I had to unroll the loop like this:
And now - as it turns out - this specific driver implementation also doesn't support passing a texture sampler as a function parameter, because it works totally fine when I do this:
So I had to define three separate copies of the exact same function, just to access the different shadow maps. God fucking dammit Intel. At least TELL ME.
#HowToThing#026 — Shader meta-programming techniques (functional composition, higher-order functions, compile-time evaluation, dynamic code generation etc.) to generate animated plots/graphs of 16 functions (incl. dynamic grid layout generation) within a single WebGL fragment shader.
Today's key packages:
https://thi.ng/shader-ast: DSL to write (fully type-checked) shaders directly in TypeScript and later compile them to GLSL, JS (and other target languages, i.e. there's partial support for Houdini VEX and [very] early stage WGSL...)
https://thi.ng/shader-ast-stdlib: Collection of ~220 re-usable shader functions & configurable building blocks (incl. SDFs primitives/ops, raymarching, lighting, matrix ops, etc.)
https://thi.ng/webgl-shadertoy: Minimal scaffolding for experimenting with fragment shaders (supports both normal GLSL or shader-ast flavors/compilation)
If you're new to the Shader-AST approach (highly likely!), this example will again introduce a lot of new concepts, hopefully in digestible manner! Please also always consult the package readmes (and other linked examples) for more background info... There're numerous benefits to this approach (incl. targetting different target langs and compositional & optimization aspects which are impossible to achieve (at least not elegantly) via just string concatenation/interpolation of shader code, as is much more commonplace...)
This example comes fresh off the back of yesterday's new easing function additions (by @Yura), though we're only showing a subset here...
Are you making a low resolution game, but using some modern shaders to apply fancy effects that would have taken superhuman brainpower to do if we were actually writing for the old consoles?
Do your shader effects look... out of place? Like, they're happening at a higher resolution?
Do you want an easy way to "snap" your shader's pixels to your game art's pixels? This is the thread for you?
Wrote myself a shader which forces some kind of mirror symmetry directly in the smartphone. A line is always drawn alternately from left to right and then the next line is then drawn in the opposite direction.
What you see here are actually 6 different screen shots of the smartphone display. To see the details of this effect, you have to download the 2378 × 2764 pixel image and zoom in to 1:1.