Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Summer 2015 #103

Merged
merged 50 commits into from
Sep 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
83dd724
Displacement Map effect: ability to select source channels for horizo…
brianchirls Nov 10, 2014
8742296
Bug fix in Three.js target plugin
brianchirls Dec 17, 2014
10155cf
Node types create prototype from parent instead of using extend
brianchirls Nov 11, 2014
fd10634
Fix divide-by-zero bug in chroma effect #80
brianchirls Jan 13, 2015
95b4f2a
Remove duplicate variable declaration
brianchirls Jan 16, 2015
a12e7f0
Added some missing semicolons
brianchirls Jan 16, 2015
26d3e09
Modified Three.js target example to demonstrate transparency
brianchirls Apr 22, 2015
e1d3192
Upgraded three.js (for examples) to r71
brianchirls Apr 22, 2015
56586c7
Three.js examples use `PlaneBufferGeometry` instead of `PlaneGeometry`
brianchirls Apr 22, 2015
9a2060c
Three.js source example: fix NPOT texture
brianchirls Apr 22, 2015
289acf4
Move base shader strings outside of Seriously constructor
brianchirls Apr 22, 2015
da64804
Tweak Invert effect unit test so expected output is calculated
brianchirls Apr 22, 2015
95e4eec
Change canvas output to premultiplied alpha (#88)
brianchirls Apr 22, 2015
4506461
Channel mapping example is now mobile friendly
brianchirls Apr 23, 2015
32138de
Set prototype constructor on all node types inheriting from Node, jus…
brianchirls Apr 30, 2015
4c7c114
Fix mobile touch bug in channels example
brianchirls May 11, 2015
80410f7
Correct Gamma blending applied to select plugins (#86)
brianchirls May 11, 2015
30b5754
Added `barsRate` parameter to TV Glitch effect... (#82)
brianchirls May 12, 2015
2f5423f
Any plugins using `timer` as a parameter name now use `time` so they'…
brianchirls May 12, 2015
9c3784d
Removed unnecessary bind (which is slow)
brianchirls May 15, 2015
0b4da33
Bug fix: common shaders failed to rebuild when restoring lost WebGL c…
brianchirls May 15, 2015
83324fe
Clean up plugin added to unit test in previous commit
brianchirls May 15, 2015
8a8357a
Color Temperature effect
brianchirls Jun 9, 2015
783ed61
noted color temp effect in readme
brianchirls Jun 10, 2015
19964bb
Fix spaces in temperature effect plugin
brianchirls Jun 12, 2015
e862114
Fixed some spaces, text
brianchirls Jun 12, 2015
fdb522e
Shader array uniforms no longer have the index as part of the name
brianchirls Jun 14, 2015
791bc87
Bug fix: Destorying Seriously instance fails to clean up node objects…
brianchirls Jun 14, 2015
1e2adc7
Remove unused variables from Drunk Video example
brianchirls Jun 15, 2015
e5e418d
Added Color Look-Up Table effect, with example
brianchirls Jun 16, 2015
492317d
Added LUT example to examples page #96
brianchirls Jun 16, 2015
e71cfc6
Fixed some lint errors
brianchirls Jun 25, 2015
2d51781
Add '#define SHADER_NAME ...' to all shaders for debugging in Shader …
brianchirls Jun 25, 2015
1242a99
Changed UMD header for all files so they work with CommonJS #85
brianchirls Jun 26, 2015
74ec65a
Merge branch 'develop' into lut
brianchirls Jun 28, 2015
f172b56
Update LUT effect for #91; Added comment crediting BBC for shader
brianchirls Jun 28, 2015
0c174ab
Merge pull request #96 from brianchirls/lut
brianchirls Jun 28, 2015
281a7fe
Add startColor input to Accumulator effect (#23)
brianchirls Jul 1, 2015
62532b4
Added credit to Paul Golds @ BBC for LUT shader (#96)
brianchirls Jul 1, 2015
6244ff0
More verbose shader linking errors
brianchirls Aug 26, 2015
a00cff0
Output shader-related implementation limits when shader linking fails
brianchirls Aug 26, 2015
c90095f
Sources and targets now accept elements in same-origin iframes #102
brianchirls Sep 3, 2015
704c8f0
Removed junk files accidentally added in previous commit
brianchirls Sep 3, 2015
3bd7a89
Blur shaders use fewer varyings
brianchirls Sep 3, 2015
7661549
Refactor color validator function
brianchirls Sep 4, 2015
df1dd26
Made blur example less annoying
brianchirls Sep 4, 2015
bbba1f2
Fix rendering to target in same-origin iframe #102
brianchirls Sep 4, 2015
dc26316
Added `mod` option to number inputs (#90)
brianchirls Sep 5, 2015
77a6faf
Time parameters passed through a modulo operation. Noise functions do…
brianchirls Sep 5, 2015
f34009e
Add Optical Flow effect with example #97
brianchirls Sep 5, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ Full documentation is in progress at the [wiki](https://github.com/brianchirls/S
- Checkerboard Generator
- Chroma Key
- Color Complements
- Color Generator
- [Color Cube](http://www.youtube.com/watch?v=rfQ8rKGTVlg&t=24m30s)
- Color Generator
- Color Look-Up Table
- Color Select
- Color Temperature
- Crop
- [Daltonize](http://www.daltonize.org/p/about.html)
- Directional Blur
Expand All @@ -59,6 +61,7 @@ Full documentation is in progress at the [wiki](https://github.com/brianchirls/S
- Luma Key
- Mirror
- Night Vision
- Optical Flow
- Panorama
- Pixelate
- Polar Coordinates
Expand Down
59 changes: 52 additions & 7 deletions effects/seriously.accumulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
factory(root.Seriously);
}
}(this, function (Seriously) {
}(window, function (Seriously) {
'use strict';

/*
Expand Down Expand Up @@ -92,7 +92,28 @@
clear: false
},
frameBuffers,
fbIndex = 0;
fbIndex = 0,
me = this,
width = this.width,
height = this.height;

function clear() {
var gl = me.gl,
width = me.width,
height = me.height,
color = me.inputs.startColor;

if (gl && width && height) {
gl.viewport(0, 0, width, height);
gl.clearColor.apply(gl, color);

gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffers[0].frameBuffer);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);

gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffers[1].frameBuffer);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
}
}

return {
initialize: function (initialize, gl) {
Expand All @@ -101,12 +122,14 @@
this.frameBuffer,
new Seriously.util.FrameBuffer(gl, this.width, this.height)
];
clear();
},
shader: function (inputs, shaderSource) {
var mode = inputs.blendMode || 'normal';
mode = mode.toLowerCase();

shaderSource.fragment = [
'#define SHADER_NAME seriously.accumulator.' + mode,
'precision mediump float;',

'const vec3 ZERO = vec3(0.0);',
Expand Down Expand Up @@ -266,15 +289,21 @@
'uniform sampler2D previous;',

'uniform float opacity;',
'uniform float blendGamma;',

'vec3 BlendOpacity(vec4 base, vec4 blend, float opacity) {',
//apply blend, then mix by (opacity * blend.a)
' vec3 blendedColor = BlendFunction(base.rgb, blend.rgb);',
' return mix(base.rgb, blendedColor, opacity * blend.a);',
'}',

'vec4 linear(vec4 color, vec3 gamma) {',
' return vec4(pow(color.rgb, gamma), color.a);',
'}',

'void main(void) {',
' vec4 topPixel = texture2D(source, vTexCoord);',
' vec3 exp = vec3(blendGamma);',
' vec4 topPixel = linear(texture2D(source, vTexCoord), exp);',
' vec4 bottomPixel = texture2D(previous, vTexCoord);',

' if (topPixel.a == 0.0) {',
Expand All @@ -287,17 +316,21 @@
'#else',
' alpha = bottomPixel.a;',
'#endif',
' gl_FragColor = vec4(BlendOpacity(bottomPixel, topPixel, opacity), alpha);',
' bottomPixel = linear(bottomPixel, exp);',
' gl_FragColor = vec4(pow(BlendOpacity(bottomPixel, topPixel, opacity), 1.0 / exp), alpha);',
' }',
'}'
].join('\n');

return shaderSource;
},
resize: function () {
if (frameBuffers) {
frameBuffers[0].resize(this.width, this.height);
frameBuffers[1].resize(this.width, this.height);
if (frameBuffers && (this.width !== width || this.height !== height)) {
width = this.width;
height = this.height;
frameBuffers[0].resize(width, height);
frameBuffers[1].resize(width, height);
clear();
}
},
draw: function (shader, model, uniforms, frameBuffer, draw) {
Expand All @@ -311,6 +344,7 @@
this.texture = fb.texture;

if (this.inputs.clear) {
clear();
draw(this.baseShader, model, uniforms, fb.frameBuffer, null);
return;
}
Expand Down Expand Up @@ -338,13 +372,24 @@
type: 'boolean',
defaultValue: false
},
startColor: {
type: 'color',
defaultValue: [0, 0, 0, 0]
},
opacity: {
type: 'number',
uniform: 'opacity',
defaultValue: 1,
min: 0,
max: 1
},
blendGamma: {
type: 'number',
uniform: 'blendGamma',
defaultValue: 2.2,
min: 0,
max: 4
},
blendMode: {
type: 'enum',
shaderDirty: true,
Expand Down
2 changes: 1 addition & 1 deletion effects/seriously.ascii.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
factory(root.Seriously);
}
}(this, function (Seriously) {
}(window, function (Seriously) {
'use strict';

/*
Expand Down
2 changes: 1 addition & 1 deletion effects/seriously.bleach-bypass.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
factory(root.Seriously);
}
}(this, function (Seriously) {
}(window, function (Seriously) {
'use strict';

/*
Expand Down
30 changes: 24 additions & 6 deletions effects/seriously.blend.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
factory(root.Seriously);
}
}(this, function (Seriously) {
}(window, function (Seriously) {
'use strict';

/*
Expand Down Expand Up @@ -81,9 +81,9 @@
glow: vectorBlendFormula('BlendReflectf(blend, base)')
},
nativeBlendModes = {
normal: ['FUNC_ADD', 'SRC_ALPHA', 'ONE_MINUS_SRC_ALPHA', 'SRC_ALPHA', 'DST_ALPHA']/*,
add: ['FUNC_ADD', 'SRC_ALPHA', 'ONE_MINUS_SRC_ALPHA', 'SRC_ALPHA', 'DST_ALPHA']*/
//todo: multiply, screen
//native blend modes removed for now, because they don't work with linear blending
// normal: ['FUNC_ADD', 'SRC_ALPHA', 'ONE_MINUS_SRC_ALPHA', 'SRC_ALPHA', 'DST_ALPHA']
//todo: add, multiply, screen
},
identity = new Float32Array([
1, 0, 0, 0,
Expand Down Expand Up @@ -231,6 +231,7 @@
}

shaderSource.vertex = [
'#define SHADER_NAME seriously.blend.' + mode,
'precision mediump float;',

'attribute vec4 position;',
Expand All @@ -257,6 +258,7 @@
].join('\n');

shaderSource.fragment = [
'#define SHADER_NAME seriously.blend.' + mode,
'precision mediump float;',
'varying vec2 vTexCoord;',
'uniform sampler2D source;',
Expand All @@ -275,6 +277,7 @@

//todo: need separate texture coords for different size top/bottom images
shaderSource.vertex = [
'#define SHADER_NAME seriously.blend.' + mode,
'precision mediump float;',

'attribute vec4 position;',
Expand All @@ -301,6 +304,7 @@
].join('\n');

shaderSource.fragment = [
'#define SHADER_NAME seriously.blend.' + mode,
'precision mediump float;',

'const vec3 ZERO = vec3(0.0);',
Expand Down Expand Up @@ -459,21 +463,28 @@
'uniform sampler2D top;',
'uniform sampler2D bottom;',
'uniform float opacity;',
'uniform float blendGamma;',

'vec3 BlendOpacity(vec4 base, vec4 blend, float opacity) {',
//apply blend, then mix by (opacity * blend.a)
' vec3 blendedColor = BlendFunction(base.rgb, blend.rgb);',
' return mix(base.rgb, blendedColor, opacity * blend.a);',
'}',

'vec4 linear(vec4 color, vec3 gamma) {',
' return vec4(pow(color.rgb, gamma), color.a);',
'}',

'void main(void) {',
' vec4 topPixel = texture2D(top, texCoordTop);',
' vec3 exp = vec3(blendGamma);',
' vec4 topPixel = linear(texture2D(top, texCoordTop), exp);',
' vec4 bottomPixel = texture2D(bottom, texCoordBottom);',

' if (topPixel.a == 0.0) {',
' gl_FragColor = bottomPixel;',
' } else {',
' gl_FragColor = vec4(BlendOpacity(bottomPixel, topPixel, opacity), bottomPixel.a);',
' bottomPixel = linear(bottomPixel, exp);',
' gl_FragColor = vec4(pow(BlendOpacity(bottomPixel, topPixel, opacity), 1.0 / exp), bottomPixel.a);',
' }',
'}'
].join('\n');
Expand Down Expand Up @@ -541,6 +552,13 @@
}
}
},
blendGamma: {
type: 'number',
uniform: 'blendGamma',
defaultValue: 2.2,
min: 0,
max: 4
},
sizeMode: {
type: 'enum',
defaultValue: 'bottom',
Expand Down
Loading