RSSAmplifier

Blog

cprimozic.net Blog

Personal website of Casey Primozic / ameo

cprimozic.netRSS feed ↗57 posts

Latest posts

A Unique Performance Optimization for Geoscript

A Modern Recommender Model Architecture

Background I've recently finished developing, training, and deploying a neural network-based recommender model. It takes a user profile (consisting of a set of entities and optionally ratings for those entities) and outputs values that can be used to create an ordered list of recommendations based on it. It does this by learning patterns across both different users as well as different entities…

Generating 3D Meshes From Text

The Tech Behind Geotoy

Overview Geotoy is a Shadertoy-inspired web app for building 3D meshes with code. It includes a custom DSL called Geoscript which provides a syntax and wide set of built-in functions for generating, combining, and manipulating 3D geometry. Geotoy wasn't really something I set out with the goal of building at the beginning. It emerged as the natural progression of my experiments and other…

Compiling the Boundary-First-Flattening Library to Wasm

Non-Pointless Software Projects for New Devs in the LLM Age

I, like many other devs, learned most of my coding by building projects. I've never been one to read textbooks or tutorials through chapter by chapter - I prefer to start something and then look stuff up along the way and trial-and-error my way to the end. Building a portfolio of projects to show off your skills is still highly recommended to college-age devs trying to land their first job…

Building Modular Audio Nodes in Web Audio

For the past several years, I've been working on and off on a browser-based DAW and audio synthesis tool which is still stuck with the placeholder name Web Synth. When the project first started off, it was a wrapper around native Web Audio nodes with a MIDI editor. As I continued to work on it, the platform gained more and more custom nodes and modules to add functionality beyond that which was…

Optimizing Advent of Code D9P2 with High-Performance Rust

I took part in Advent of Code 2024 this year. It's a yearly event where a new holiday-themed programming puzzle is released every day of December through Christmas, and people from all across the internet compete to see who can solve them the fastest. It's a great place to experiment around with writing low-level, high-performance Rust - as well as learn from the extremely smart people who also…

Creating Constrained Bezier Curves for an Envelope Generator

Notes on Self Hosting a Bluesky PDS Alongside Other Services

A Small Change to Significantly Improve Triplanar Mapping

Fixing a Bug in Google Chrome as a First-Time Contributor

I recently finished up the process of fixing a bug in the Chromium/Google Chrome web browser. It was my first time contributing to the Chromium project or any other open source project of that scale, and it was a very unique experience compared to other open source work I've done in the past. I figured that I'd write up an overview of the whole process from beginning to end to give some…

My Favorite Tools + Techniques for Procedural Gamedev

For a couple of years now, I've been working on and off on some 3D scenes and levels that run in the browser. It started off as a scattering of self-contained demos for some custom shaders or similar that I wanted to try out, but over time the project has grown into a pretty substantial interconnected game-like thing. One of the unifying themes of the work is the use procedural and generative…

Trying Kolmogorov-Arnold Networks in Practice

There's been a fair bit of buzz about Kolmogorov-Arnold networks online lately. Some research papers were posted around claiming that they offer better accuracy or faster training compared to traditional neural networks/MLPs for the same parameter count. I was compelled by these claims and decided to test them out myself. Here are my main findings if you're not interested in reading through the…

Computing Normals for "Smooth by Angle" Shading Like Blender

Background As part of some other work I was doing that involved programmatically manipulating 3D meshes, I encountered the need to compute normals for them from scratch. Usually this isn't necessary since applications like Blender handle doing this automatically. But in my case, I was doing these transformations dynamically and in the web browser for my Three.JS application. If I wanted normals…

A Process for Subdividing + Deforming Arbitrary 3D Meshes

Overview When I started off, my goal was simply to subdivide 3D meshes. I wanted to add more geometry to simple meshes so that I could apply programmatic deformation like greebling and noise to give them increased detail and realism in procedurally and semi-procedurally-generated scenes. It turns out that basic mesh subdivision is indeed very simple and can be implemented in a few dozen lines of…

What I've Learned Building Interactive Embedding Visualizations

Over the past few years, I've built several different interactive embedding visualizations. I have a big interest in exploring and understanding things in a free-form manner, and these kinds of tools feel to me like an extremely effective way of facilitating that sort of experience. My work in this area started out as an experiment using data I collected for a different project. I then repeated…

Trying Out Cloudflare's `foundations` Library for Rust

A couple of months ago, I happened across the announcement blog post from Cloudflare for their newly released library for Rust. It looked like something I'd definitely be interested in using, and I mentally marked it down as something to check out when a good opportunity came up. Well, that opportunity recently came around - so I went ahead and tried it out! I set up a small, self-contained…

PIXI.JS Optimizations

Building a Realistic Raindrop-Covered Window Pane Material in Three.JS

Wrapping Meshes With Geodesic Walks

Overview I've been working on building a game engine of sorts in Three.JS, and along the way I've been creating some levels and demos for it. My 3D modelling skills have come a long way but they're still quite bad, so I've been using procedural or semi-procedural generation a lot as part of my work. For one level I was working on, I wanted to cover the surface of a large building with decorations…

Speeding Up Geodesic Tracing in geometry-central

amdgpu_top: A Modern radeontop Alternative

Generating 4K PBR Textures Using Stable Diffusion XL

Building RNN Architecture Visualizations With TikZ

Growing Bonsai Networks with RNNs

This writeup introduces what I'm calling Bonsai Networks - extremely sparse computational graphs produced by training and pruning RNNs. They provide an interpretable view into the solutions learned by networks for simple logic problems, breaking out of the black box neural networks typically reside in. I give an overview of the process I use to create these networks which includes several custom…

Machine Learning Benchmarks on the 7900 XTX

Drawing Graphviz Edge Splines

Building a Signal Analyzer with Modern Web Tech

I recently spent some time building a browser-based signal analyzer (spectrogram + oscilloscope) as part of one of my projects. I ended up using some very modern browser APIs and technologies that I'd not worked with before, and I discovered a lot of really interesting patterns and techniques that I'd never seen before in a web app. This inspired me to write about the individual APIs that I used…

Reverse Engineering a Neural Network's Clever Solution to Binary Addition

There's a ton of attention lately on massive neural networks with billions of parameters, and rightly so. By combining huge parameter counts with powerful architectures like transformers and diffusion, neural networks are capable of accomplishing astounding feats. However, even small networks can be surprisingly effective - especially when they're specifically designed for a specialized use-case…

Implementing Depth Pre-Pass Optimization for Three.JS

This is a follow-up post that improves upon one I wrote yesterday. The last post implemented this optimization in a manual way, but it turns out that it's possible to do it in a much simpler and more efficient manner using built-in WebGL/OpenGL features. Thanks to /u/kibakufuda and /u/cesium-sandwich in the reddit comments for sharing that info! The Problem As I mentioned in my previous post, I…

Speeding Up Three.JS with Depth-Based Fragment Culling

Important Note Since releasing this article, I've been informed that there is actually an even easier and more efficient way of achieving the optimization detailed in this post. It turns out that the main concept implemented here is already commonly used in game engines and other 3D applications, and it's known as a depth pre-pass. Additionally, rather than writing custom shader code to read from…

Logic Through the Lens of Neural Networks

Recently, I was experimenting with building small neural networks for sequence-to-sequence use cases. My goal was to create a visualization of how the inner state of a RNN changes as it processes inputs - similar to the browser-based neural network visualization I built previously. I was inspired to explore this area after reading a very interesting blog post called Differentiable Finite State…

Middle-End Development with SvelteKit + TensorFlow.JS

I've been building a project over the past month or so — an interactive recommendation web app powered by a relatively basic neural network. Building it has been one of my most unique, engaging, and memorable dev experiences in recent memory. There are multiple reasons for this, and after thinking about it I figure it boils down to two technology choices that underpin the whole project: SvelteKit…

Exploring Neural Networks Visually in the Browser

While teaching myself the basics of neural networks, I was finding it hard to bridge the gap between the foundational theory and a practical "feeling" of how neural networks function at a fundamental level. I learned how pieces like gradient descent and different activation functions worked, and I played with building and training some networks in a Google Colab notebook. Modern toolkits like…

My Evaluation of SvelteKit for Full-Stack Web App Development

I recently tried out SvelteKit for the first time. This is a summary of my experience setting it up, some information I've collected while researching + learning it, and my thoughts on how it compares to other similar frameworks. If you're not familiar with it, SvelteKit is a framework for building full stack web apps. It builds on top of Svelte and provides a Jamstack environment with support…

My Setup for Self-Hosting Dozens of Web Applications + Services on a Single Server

Over the years, I've accumulated quite a collection of websites, web applications, APIs, and other services that I've built and continue to host publicly. I've experimented with a lot of different hosting methods for them, switched between several different providers, and have finally arrived at something that I feel comfortable with that meets all my needs. There are nearly infinite options…

Habits I've Developed for Fast + Efficient Programming

There's been a lot of discussion recently about working fast and being productive in software development, and I thought I'd share some of my own strategies that I've developed for that purpose. There's a lot more than just writing code that goes into being an effective software developer, and there's naturally a lot of discussion that goes on about what those other things are. However, the core…

Using Graph Embeddings for Music Visualization + Discovery with node2vec

If you listen to music using a modern platform like Spotify, YouTube, SoundCloud, or similar, chances are you've had songs programmatically recommended to you in some way or another. These recommendations were likely generated by a machine learning model or other data-driven approach that takes information about you and what you listen to and predicts other songs or artists you'll also like. In…

Building Music Galaxy — An Interactive 3D Visualization of Musical Artists

Music Galaxy is is the culmination of several months of work with artist relationship data from Spotify. It is an interactive 3D visualization of the relationships between over 70,000 artists, positioning them in such a way that artists with similar audiences are closer together in space. It also supports connecting to users' Spotify accounts to visualize where their personal favorite artists…

Speeding Up the Webcola Graph Viz Library with Rust + WebAssembly

For a recent project I've been working on, I wanted to include a graph showing the relationships between different artists on Spotify. Spotify provides the data directly from their API, and I had everything set up to pull it for a user's top artists and into the browser. This is the story of how I took the initial unoptimized graph visualization - which ran at <10 FPS on my powerful desktop - and…

FM Synthesis in the Browser with Rust, Web Audio, and WebAssembly with SIMD

As web browsers have grown and evolved over the years, they've gained many APIs and functionalities that have made them into incredibly capable application platforms in addition to their original role of web page renderers. One of the APIs that I've been particularly interested in is the Web Audio API and its capabilities as a foundation for browser-based audio synthesis and DSP programming…

Finding + Fixing a AudioWorkletProcessor Performance Pitfall

TL;DR: There is a non-zero cost that scales linearly with the number of parameters s have. If you are seeing issues with long execution times for with low execution times on the inner "(author script execution)" for the method itself, check if the total number of parameters you have on your AWPs is high. In my case, I reduced it from 544 to 96 which got rid of my performance issue entirely…

Building SPF420 x SYNC^UP - An Online Concert Experience

Back at the beginning of 2020, I become involved with the people who founded SPF420 - a group of musicians and artists who had started hosting live concerts over an ancient video chat application called TinyChat years before virtual concerts or online events were really even a thing. With the situation created by COVID-19, there was an explosion in activity in the digital events space and they…

Debugging a Hanging Apache2 Server on the Fly

Yesterday, I made a comment on Reddit that included a link to a screenshot I took using my personal screenshot hoster application. The comment was in a very active /r/worldnews thread about the Iranian missile attacks against US military bases, and it soon picked up a lot of steam. Within an hour after posting, I was getting hundreds of requests per minute to the image from Reddit users and of…

Building a Statically Linked `wasm-opt` for Continuous Deployment

UPDATE 2021-06-26 Binaryen, the repository that contains , actually builds for alpine/statically linked as part of its CI Pipeline. Stealing their code for that, here's a very simple script that handles building statically, no extra work required: That's it! Verifying that the generated binary is actually statically linked: Here's the original blog post for posterity: When deploying…

Building a Wavetable Synthesizer from Scratch with Rust, WebAssembly, and Web Audio

A spectrogram visualization of the output of a wavetable of which this article details the construction Overview Wavetable Synthesis is a method for synthesizing audio by interpolating between different pre-sampled waveforms stored in a table. It's a very neat way to generate sounds that change over time, allowing the different waveforms to morph into each other slowly in order to create rich and…

Using Rayon for Simple Parallelization of SQL Queries in Rust

While working on the API backend for my Spotifytrack application, I encountered a situation where I needed to fetch two separate pieces of data from the database and combine them both into the response. The SQL queries that returned them could sometimes be non-trivial and take nearly a second to complete, and running them both in series was causing a noticeable wait period in the UI while waiting…

My Thoughts on Rust's Future: A Positive Outlook

I'm feeling really positive about Rust's prospects of popularity and wide-spread adoption in the future. I've been a part of the Rust community for three years now, and it feels like the stars are starting to align in order to let Rust jump into a position of dominance in the programming language world. There are several different, wide-spread, and mostly unrelated trends that I've noticed are…

Deploying a REST API with Rust, Diesel, Rocket, and MySQL on Google Cloud Run

Google Cloud has a service called Cloud Run, a platform for running stateless webservers via containers in the cloud. It combines the best aspects of both serverless architecures and hosted container solutions such as Amazon's EKS, making the process of deploying stateless web applications to the cloud easier than ever before. In addition, it's extremely flexible with regard to the actual…