Casey Primozic’s Notes

Misc. notes, code, and other content I want to post publicly that don’t warrant a full blog post

By Casey Primozic

Subscribe to RSS

Fixing pmndrs Postprocessing Recursive Depth Texture Binding

I’ve been working on building 3D scenes and environments in the browser using Three.JS. As part of those, I make pretty heavy use of the pmndrs postprocessing library for post-processing and effects. I’ve also implemented a custom godrays effect that works with postprocesing called three-good-godrays. It creates a custom pass that is added to the postprocessing EffectComposer which renders volumetric screen-space godrays by reading the depth buffer and shadow map for a light.
Read more →

Fixing “performance is not defined” Issue with Svelte/SvelteKit

The Issue When building my SvelteKit project, I get lots of errors like this in my console: ERROR in ./src/graphEditor/nodes/CustomAudio/MIDIToFrequency/MIDIToFrequencySmallView.svelte Module build failed (from ./node_modules/svelte-loader/index.js): ReferenceError: performance is not defined at now (/home/casey/web-synth/node_modules/svelte/compiler.cjs:7:31) at new Stats (/home/casey/web-synth/node_modules/svelte/compiler.cjs:47:21) at compile (/home/casey/web-synth/node_modules/svelte/compiler.cjs:45535:16) at injectVarsToCode (/home/casey/web-synth/node_modules/svelte-preprocess/dist/transformers/typescript.js:85:45) at mixedImportsTranspiler (/home/casey/web-synth/node_modules/svelte-preprocess/dist/transformers/typescript.js:257:26) at transformer (/home/casey/web-synth/node_modules/svelte-preprocess/dist/transformers/typescript.js:336:11) at transform (/home/casey/web-synth/node_modules/svelte-preprocess/dist/autoProcess.js:46:12) at async /home/casey/web-synth/node_modules/svelte-preprocess/dist/autoProcess.js:117:29 at async script (/home/casey/web-synth/node_modules/svelte-preprocess/dist/autoProcess.js:147:33) at async process_single_tag (/home/casey/web-synth/node_modules/svelte/compiler.cjs:45984:21) at async Promise.all (index 0) at async replace_in_code (/home/casey/web-synth/node_modules/svelte/compiler.
Read more →

Fixing “can’t resolve ‘svelte/internal’” Error After Upgrading svelte

I bumped several of the dependencies for one of my projects. It uses Svelte and Webpack, and makes use of svelte-loader to facilitate importing .svelte files. I upgraded Svelte from v3.57.0 to v4.2.0, and bumped svelte-loader, svelte-preprocess, prettier-plugin-svelte, and many other libraries to their latest versions as well. After the upgrade, my Webpack dev server started up but failed to load with many errors like these displayed in the console:
Read more →

amdgpu_top: A Modern radeontop Alternative

I’ve been using a tool called radeontop for years to monitor the performance and utilization of my AMD GPUs on Linux. It’s a TUI-based application that renders the value of different performance counters as bar charts: For the most part, it does a good job and it provides a concise overview of GPU utilization. However, it seems that radeontop is no longer actively developed/updated. It’s received ~7 commits in the past ~3 years and although it does still mostly work even with the latest GPUs like the 7900 XTX, but it’s not under active development.
Read more →

Generating 4K PBR Textures Using Stable Diffusion XL

I’m picking back up the work that I started last year building 3D scenes and sketches with Three.JS. At that time, it was just after AI image generators like DALL-E and Stable Diffusion were really taking off. I had success running Stable Diffusion locally and using it to generate textures for terrain, buildings, and other environments in the 3D worlds I was building. I was using Stable Diffusion v1 back then.
Read more →