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

Some Casual Art

I’ve been trying to get into the habit of drawing casually as opposed to doing so as part of some contest or project. Part of that is just drawing what I feel in the moment. I’m not intending to follow any style but at the same time I’m not stopping myself from easing any habits which resulted with a few pictures that do share a style. I always felt with drawing that I have no clue what my style is....

July 13, 2023

3D Matrix Rotations

Intuition of 3x3Matrix Transformations Rotations can be achieved by locking the desired axes of rotation and transforming the rest of the axes by \(sin\) and \(cos\). 3x3 matrices can be used to bend the coordinate space in 3 dimensions, effectively allowing any desired transformations to objects in that space. As the coordinate space is being transformed, it’s helpful breaking up the matrix into its unit vectors $$ \vec{a} = x\begin{bmatrix}1\\0\\0\end{bmatrix} + y\begin{bmatrix}0\\1\\0\end{bmatrix} + z\begin{bmatrix}0\\0\\1\end{bmatrix} $$...

June 15, 2023

Intro to Deep Learning

Neural Networks See Machine Learning How do you decide how many neurons to use per layer? One way is to start with all layers uing the same amount of neurons and continue adding them until they start overfitting the data Dropout: Regularlization technique to avoid overfitting. Leaves out data to better deal with general cases. 20%-50% dropout is a good starting range. Momentum: Helps finding the direction of next descent and prevent oscillations....

June 12, 2023

Overview of Probability

I’ve always had trouble understanding probability, especially when entering into the more theoretical aspects of it. Here, I want to cover some of the basic concepts and functions core to probability in an easily digestible format that I can refer to later on when I inevitably forget it all. Random Variable Whenever there’s a question of probability, you tend to have some range of possible outcomes sourced from a specific event....

June 4, 2023

Intro to Machine Learning

In preparation for a deep learning course I’m taking over the Summer, I’m taking a short intro course on machine learning to help prepare me for some of the fundamental concepts. I’ve been avoiding AI for a while but given its ongoing application in nearly everything now, I figure it’s more than worth getting my feet wet. ML Overview flowchart LR subgraph Shader Lifecycle direction LR d[("Dataset")] --> m(("Model")) --> o("...

May 28, 2023

Handling Normals from Unity to Blender

While trying to import a plane from Blender to Unity, I ran into the issue of the normals facing the wrong direction once imported into Unity. This was particularly an issue when it came to vertex shaders as any vertex transform performed incorrectly. This crux of the issue is that Blender considers the z-axis to be the vertical axis while unity considers the y-axis to be. So, for a plane in Blender, the normals would face towards the positive z-axis but when imported to Unity, they remain so which to Unity is actually along the horizontal plane....

May 15, 2023

Playing With GLSL

From what I’ve read, one of the classic shader introductions people reference is this online module-of-sorts known as TheBookOfShaders. On there, it covers topics of how math can generates different shapes and textures within shaders along with plenty of examples and tip from basic to more advanced creations. Drawing Circles A Circle Using step To start, this is what it looks like using the step() function where for a circle of a radius, if the pixel is outside of this radius, give a value of 1, if not, return a 0....

May 11, 2023