Skip to content

Instantly share code, notes, and snippets.

View charlieroberts's full-sized avatar

charlie roberts charlieroberts

View GitHub Profile
@charlieroberts
charlieroberts / swg_api.md
Created September 16, 2022 16:58
simulation api

inRange - sum - equals - getProp - setProp - move - convenience that calls setProp on x,y,z

@charlieroberts
charlieroberts / hydra.md
Created August 24, 2022 17:52
a short hydra tutorial

Hydra

You can find Hydra at: < hydra >

The easiest way to get started is to start changing numbers in existing sketches (you can load new random sketches by hitting the reload button in the upper right corner) and hitting ctrl+shift+enter to see how your results change after modifying the code.

There’s lots of commented examples to look at here: hydra-examples/0-getting-started.js at master · ojack/hydra-examples · GitHub

And there’s documentation for the various functions at: hydra/funcs.md at master · ojack/hydra · GitHub

Let’s start by creating an oscillator similar to what we did in The Force:

@charlieroberts
charlieroberts / ray_marching_materials.md
Last active September 17, 2020 18:21
links for online talk/workshop on ray marching and the demoscene
@charlieroberts
charlieroberts / equinox_marchingjs.md
Created March 21, 2020 00:38
Equinox Marching.js Tutorial

Marching.js

This demo tutorial will mainly focus on getting started using marching.js playground, a browser-based tool for live coding with ray marchers. I’ve added some extra information at the beginning on the demoscene, which was an important source of inspiration for marching.js. Here’s a recent article on the demoscene: Here’s some Sanity, literally, and Amiga Dreams as read for you in French - CDM Create Digital Music

Demoscene

The demoscene is a culture that began in the 1980s, when hackers created “cracktros” for the software they cracked… these were short audiovisual demos that showed off the skills of the hacker and often contained shoutouts to their other hackers / friends.

Over time, some hackers/artists became more interested in the audiovisual demos than they were in pirating software, and this became the birth of the “demoscene”, where programmers would create audiovisual “demos” that

@charlieroberts
charlieroberts / march_10_julia_twist.js
Created March 11, 2020 19:24
A Julia set rotating through a twist
// copy and paste into https://charlieroberts.github.io/marching/playground/
// select all and hit ctrl+enter
mat1 = Material( 'phong', .05, 1, .5 )
mat2 = Material( 'phong', 0, .1, .25 )
march(
t = Twist(
b = Julia().material( mat1 ).scale(.4),
Vec2(10)
),
@charlieroberts
charlieroberts / march_9_hexagons.js
Created March 9, 2020 22:28
lots and lots of hexagons
// copy and paste into https://charlieroberts.github.io/marching/playground/
// select all and hit ctrl+enter
// turn quality to 'high' if you have a nice gfx card
quality = 'med'
size = .01/4
m = HexPrism( Vec2(size,size/16) ).material('green')
mirrors = []
count = 19
@charlieroberts
charlieroberts / march_7_ewwww.js
Created March 7, 2020 22:02
mandelbulb w/ simplex noise
// copy and paste into https://charlieroberts.github.io/marching/playground/
// select all and hit ctrl+enter
mat1 = Material( 'phong', Vec3(.0),Vec3(1,.8,.8),Vec3(1), 32, Vec3(0,.15,.25) )
march(
RoundUnion(
m = Mandelbulb( Noise(.225,4,.5) ).material( mat1 ),
Plane().material(mat1),
.25
)
@charlieroberts
charlieroberts / march_6_ringsringsrings.js
Created March 6, 2020 23:41
lots and lots of rings
// copy and paste into https://charlieroberts.github.io/marching/playground/
// select all and hit ctrl+enter
// turn the count up to 100 if you have a nice gfx card,
// otherwise, leave as is or risk graphics card meltdown
count = 25
Material.default = Material.white
arr = Array(count)
arr = arr.fill(0).map( (v,i) => {
@charlieroberts
charlieroberts / folding_squirmer.js
Created March 6, 2020 02:23
folding "lifeform" using marching.js
// copy and paste into https://charlieroberts.github.io/marching/playground/
// select all and hit ctrl+enter
quality = 'med' // try 'high' if you have a nice gfx card
size = .025/8
box = Box(size).material('white glow')
count = 25
mrrr = Mirror( box ).translate(size,size,size)
mirrors = [ mrrr ]
for( let i = 0; i < count; i++ ) {
// copy and paste into https://charlieroberts.github.io/marching/playground/
// select all and hit ctrl+enter
march(
ru = RoundUnion(
m2 = Mirror(
m1 = Mirror(
m = Mirror(
j = Julia( 3.5 )
.translate( .25,.25,.75 )
.material('glue')