glsl-projectron

WebGL demo to evolve data that projects into a given target image

  • 所有者: fenomas/glsl-projectron
  • 平台:
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

GLSL-Projectron


This is a WebGL/GPGPU demo I made to try out shader programming. It generates random 3D polygons which resemble a given target image when projected. Basically it's similar to this, but done in 3D and on the GPU.

After many generations, you get a chaotic bunch of polygons that align into an image, but only from just the right angle:

Screencap of sample output

Live demos:

I also put up a blog post here explaining the algorithm, and how I made it run fast on the GPU.

Installation & Usage

git clone [this repo]
cd glsl-projectron
npm install
npm start

That serves a local build of the "Create" demo linked above, in localhost:8080.

Use npm run build to rebuild the static version in /docs.

To use this as a dependency, follow the example in /demo/maker.js:

import { Projectron } from 'path/to/glsl-projectron'
var proj = new Projectron(canvasElement)

var img = new Image()
img.onload = () => { proj.setTargetImage(img) }
img.src = 'path/to/image.png'
//..
proj.runGeneration()    // many times..
proj.draw(x,y)          // once per frame..

Known issues:

  • Doesn't detect most error cases (just whether WebGL is supported)
  • Library treats input images as if they were square. To use for other aspects, just run it normally and change the aspect of the canvas you use to display the results.

Credits

Made with ? by Andy Hall. MIT license.

主要指標

概覽
名稱與所有者fenomas/glsl-projectron
主編程語言JavaScript
編程語言JavaScript (語言數: 2)
平台
許可證
所有者活动
創建於2014-12-07 08:19:20
推送於2023-11-06 16:02:15
最后一次提交2023-11-07 01:02:13
發布數0
用户参与
星數321
關注者數10
派生數26
提交數48
已啟用問題?
問題數1
打開的問題數1
拉請求數3
打開的拉請求數21
關閉的拉請求數6
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?