Coder Social home page Coder Social logo

markusgaelli / glsl-projectron Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fenomas/glsl-projectron

0.0 0.0 0.0 11.23 MB

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

Home Page: https://fenomas.github.io/glsl-projectron/

JavaScript 82.36% GLSL 17.64%

glsl-projectron's Introduction

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 wrote 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.

glsl-projectron's People

Contributors

fenomas avatar amilajack avatar dependabot[bot] avatar nariyu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.