# Ye Olde WebGL Canvas with ThreeJS

This is my first post on 3D graphics with WebGL & Three.js. I set up a section of my blog with an interactive template, so I can easily create more of these. This demo was ripped out of the Three.js examples by the way. It’s slightly modified to move the camera in the z-axis according to the mouse’s distance from the center of the browswer window. I need to figure out how to read touch input for mobile browsers, but for now

### Social Mechanics

I hope to use these to demonstrate what I’ve been learning with math. I’m excited to work on social mechanics and social physics and doing so requires a bit of brownian motion and eigenfunctions. I independently stumbled upon this once I realized I could create a particle shader that proves many of the depressing social mechanics that get under my skin. I could do so visually in a way that’s much more difficult to argue with and feign ignorance. It’s similar to statistical mechanics and quantum mechanics. I hope to implement this stuff using compute shaders and textures in WebGL.

### It’s All About The Gigarands, Baby

My next task is to create a few random number generators and write to textures with them. I’m going to use a simple Linear Congruential Method, but with UI and controls to modulate the parameters. I may also include multiple types of random generators. My first approach to a GPU PRNG was to intuitively mimic the Wallace Transform. At least, I think that’s the approach I was taking. I downloaded a bunch of GPU PRNG papers. It’s not anything like the Merseinne prime twister. It’s quite a bit more complicated than LCM and LFSR. IMO, that’s impressive for someone who doesn’t have a college degree.

### Porting Code from Spectra

Also, I’ve written some geometry code in Swift with Metal for Spectra, so I hope to port some of that to WebGL, since it’s a bit hard to demonstrate in XCode. With the Three.js compute shader code, I can port my lattice generation code to WebGL. One project I want to work on is a 3D version of Conway’s Game of Life using a 3D lattice and computing state changes with compute shaders.