rawReflections = loadImage('studio_small_08-min.jpg')
canvas = createCanvas(600, 600, WEBGL)
cubeShader = createShader(cubeVert, cubeFrag)
const reflectionGraphic = createGraphics(600, 600*rawReflections.height/rawReflections.width)
reflectionGraphic.background(0)
reflectionGraphic.drawingContext.filter = 'blur(20px)'
reflectionGraphic.image(rawReflections, 0, 0, reflectionGraphic.width, reflectionGraphic.height)
reflections = reflectionGraphic.get()
reflectionGraphic.remove()
drawingContext.enable(drawingContext.BLEND)
bgColor = color('#f58486')
rotateX(millis() * 0.00017)
rotateY(millis() * 0.0001)
pointLight(200, 200, 200, width, -height, width/2)
pointLight(100, 100, 100, 0, -height, width/8)
drawingContext.enable(drawingContext.CULL_FACE)
drawingContext.cullFace(drawingContext.BACK)
specularMaterial(200, 200, 200, 50)
drawingContext.disable(drawingContext.CULL_FACE)
for (const { x, y, z, r, color, shine } of balls) {
drawingContext.enable(drawingContext.CULL_FACE)
drawingContext.cullFace(drawingContext.FRONT)
cubeShader.setUniform('backContent', canvas)
cubeShader.setUniform('pixelSize', [width * pixelDensity(), height * pixelDensity()])
cubeShader.setUniform('reflections', reflections)
sphere(boxR + 20, 36, 36)
drawingContext.disable(drawingContext.CULL_FACE)