GithubHelp home page GithubHelp logo

cerho's Introduction

cerho

A WebGL demo engine wannabe.

Demo data

A JSON file plus all required shaders. There is one vertex shader (shader.vert) and multiple fragment shaders (of the form *.frag). All required assets are listed in the assets portion of the demo JSON representation.

The demo data is self contained in a single directory (e.g. invi/) and all asset paths are assumed to be relative to this directory.

Parameters

Each Effect (effects object in JSON) and PlaylistEntry (playlist.entries) can contain parameters. These objects are merged prioritizing the entry parameter definitions. The contained floating point values are passed in to the respective fragment shader as shader uniforms.

Example: parameter passing

In this example we assume the effect meatballs is defined in the effects portion of the JSON file.

To pass the parameter flash to a fragment shader you need to first specify the parameter in JSON:

"entries" : [
            {
            "effect" : "meatballs",
            "begin" : 0.0,
            "end" : 15.0,
            "params" : {
                "flash" : 0.5
            }
            }

and also declare it in the fragment shader:

precision mediump float;

uniform float flash;

void main() { 
	gl_FragColor = vec4(flash, flash, flash, 1.0);
}

Debug mode

Append ?debug to url to enable debug mode.

Uniforms

ShaderToy uniforms:

uniform vec3      iResolution;           // viewport resolution (in pixels)
uniform float     iGlobalTime;           // shader playback time (in seconds)
uniform float     iChannelTime[4];       // channel playback time (in seconds)
uniform vec3      iChannelResolution[4]; // channel resolution (in pixels)
uniform vec4      iMouse;                // mouse pixel coords. xy: current (if MLB down), zw: click
uniform samplerXX iChannel0..3;          // input channel. XX = 2D/Cube
uniform vec4      iDate;                 // (year, month, day, time in seconds)

License

zlib license. See COPYING for more.

cerho's People

Contributors

atomim avatar lumianna avatar seece avatar

Stargazers

 avatar  avatar

Watchers

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