In this post I'll describe how to achieve a crystal-like refraction effect within only ThreeJS. Below is a demo of the effect that's to be achieved. You can use your mouse to change your angle and position (right-drag to rotate, left-drag to move and scroll to zoom in and out). You might need to wait a while for the texture to load.
A while ago, I read this article about abusing LOAD_CONST in Python 2.7. We are in Python 3.11 now, and CPython has since implemented quite a lot more features and checks. I wanna try to abuse the Python 3 VM to similarly execute shellcode, but I wanna do so without crashing CPython.
I mean there's the ctypes module that allows you to do literally anything. But that's not fun at all.
I did not know anything about the Python interpreter prior to starting this. I've written some high level explanation of how CPython does things below, hopefully it's correct and helpful for anybody just starting.
Also CPython source is just so easy to read. It's been a joy.
Since I wanna try this on the newest Python, I cloned CPython and built the x64 Debug and Release version of CPython. At the tim
So the Julia sets are a class of sets that have became very popular because of their beauty and an interesting object of study. The definition of a Julia set is really simple, it is the set of complex numbers \(\bold S_c\) such that for \(z \in \bold S_c\), we have \(|f^n_c(z)| \le 2\), where \(f_c(z) = z^2 + c\). Each choice of \(c\) gives rise to a different Julia set with distinct looks. I might write more about these stuff maybe but given how popular this subject is you can find a lot of it's cool properties anywhere on the internet. I suggest checking out Inigo Quilez on the subject of rendering them.
I hope your internet's good. Due to the nature of the subject it does require rather large images.
Given how simple the definitions of these sets are, it makes it really easy and straight-forward to render them. It can be done in a few lines and is one of the first things I ever coded.
The source code for the above is here, you can use the mouse to control the value of \(c\). I left the
Here I design circular screen patterns that can be used to magnify grid-like stuff, like the pixels on your screen or threads in a cloth via Moiré Patterns, such that you can calculate properties about them with a crude measuring tool like a ruler. At the same time, I present a mathematical formulation of what even are Moiré Patterns. It's a rather ad-hoc formulation, so if there are some things I missed do point it out.
I might write a follow up post where the patterns are printed on transparencies to be used IRL.
Some context: Most of these explorations happened back in 2018 with a friend of mine, Vernice. Me and Vernice even printed out the patterns on transparencies to slap on random things IRL. Unfortunately I don't have the original files and transparencies, neither did I document anything so here I've recreated everything and re-derived the Math and stuff.
What are Moiré Patterns?
Moiré Patterns are these trippy magnified patterns that come from overlapping repeated small screen pat
Have you seen something happen that seems almost impossible to replicate? Like dropping something and have it land in just the right way, or shoot an arrow and have it land on its tip?
From a simulation standpoint, you might ask what are the initial conditions required to produce that outcome. To solve this, you could attempt to search through the whole search space. For instance, you could try all possible velocity and position of the arrow and select the ones that land on it's tip. However this is plain impractical as despite only having 7 degrees of freedom (3 for rotation, 3 for position and one for initial velocity), the search space is already huge and chances are, the solutions are but a small portion of the unwieldy search space.
Ok first off, why should we care?
The arrow problem is arguable classified under 'cool' but definitely not 'practical'. However, these kinds of problems where there is a huge search space and we are searching for only a small subset of said space is ubiqu