Which Way Does the UV Go?

While I was working on writing simple shape patterns in GLSL, I ended up with an interesting conundrum. I fell into the pattern of creating shapes by closing in each side of the shape with a smoothstep in the following form. smoothstep(-blur, +blur, uv.x); In this case, this creates a vertical edge where the left side is 0 and the right side is 1. I then do the same thing for the rest of the side of the shape, until I enclose it so that all values inside the shape are 1 and everywhere else remains 0....

August 25, 2023

Pianotypes Devlog 4

Not too much to report. I had the realization that I can pause the scheduled notes by suspending the AudioContext since they depend on the context’s timer. It’d be pretty easy to add pause functionality. The only caveat is that if I pause the AudioContext, than all sound from the piano is also paused. Perhaps I could code in a notice to resume the timer given the user inputs a key press but I don’t want to resume the context on every key press....

August 25, 2023

Reviving Tabby Sort

A couple years ago I made a little extension for chrome to organize and sort tabs by url domains. It was really quick and crudely designed and since I wasn’t even a Chrome user, I didn’t think too much about improving it. Fast forward to now, I decided to do exactly that. Looking at old code Actually the code was mostly better than I expected, other than some variable naming and redundant lines, I didn’t see much need to rewrite it....

August 23, 2023

Pianotypes Devlog 3

Today I spent some time working on getting the instructions dialogues up. I originally planned on creating a secondary overlay window that pops up given a trigger. Very similar to how to the toast notifications work but instead with a much larger area. The only problem with that is I wanted a clean way to inject custom html into the dialogue box depending on who triggers it. In the case of the toast notification I just pass it a string which is fine given it’s only suppose to be a sure notifier anyways....

August 23, 2023

Pianotypes Devlog 2

I’m a bit more than late for a second devlog but I figured there’s no better thing to call this. I originally made this blog for the purposes of short and sweet devlogs but my recent posts have been bit larger than what I originally intended. I’m hoping with this log to bring that focus back down to just that. Since my previous post, I’ve done a lot of fine tuning of the UI and functionality of the site....

August 21, 2023

Revisting Pianotypes

I recently finished a course in deep learning and wanted to took a look at a few ways I could apply my knowledge to. The idea the came to me was to create an ai music generation model and feed it into my old pianotypes app. Simple right! It’s all broken So I booted up my old, dusty, untouched, forgotten, delapidated, abused, ramshackled, repository, and lo and behold, I can’t get it to run....

August 18, 2023

Svelte Reactive Classes

I’ve been working on migrating my old PianoTypes project over from Vue to Svelte. So far the syntax has been much cleaner to use and has been an overall a great experience. My first and primary pain point thus far has been implementing a global reactive state for the piano. The Problem In Vue, it’s possible to add a reactive wrapper to any object. In my case, I had created a class containing all of the piano data and property methods so all I had to do was wrap this class in the wrapper and state is maintained across all instances of my piano class....

August 12, 2023

Some More GLSL

Vertex Shaders So far, I’ve been primarily writing 2D shaders to create patterns on a flat canvas. In practice, shaders can also be applied to 3D objects to manipulate not only their textures but also their shape. To start, let’s take a look at a simple 2D shader placed on a 3D cube. Notice that the texture remains flat but is effectively cropped onto the projection of the cube. Ideally, we’d like the texture to wrap over the cube instead....

July 19, 2023

JS Modules in Hugo

While writing this blog, I’ve been constantly finding a need to include various JavaScript libraries such as graphics libraries or text processors. I love the simplicity of Markdown but sometimes it can be really helpful to include more meaningful content and visuals to better illustrate a certain topic or idea. My most recent endeavor was adding an easy way to render shaders within each of posts which turned out to be a more painful task than I originally anticipated....

July 14, 2023

Basics of Shader Fractals

Fractals are built off of a single pattern or formula, repeated constantly with smaller and smaller transformations. In glsl, this idea translates nicely into iterative coding with for loops. How to Make a Fractal I’ll be following kishimisu’s guide on shaders. Create a Shape First off, we can start by creating some base patterns that we want to design our fractal off of. In this case, we can start with a simple circle....

July 13, 2023