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 2014-07-25 #67

Merged
merged 35 commits into from
Jul 25, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
283fe51
Remove html5slider #47
brianchirls May 7, 2014
d9fb56f
Ability to set default input values on any effect as an option #59
brianchirls May 7, 2014
d631644
Added Color Select effect
brianchirls May 9, 2014
170074a
Vertex shader in Color Select needs to use standard position calculat…
brianchirls May 10, 2014
a9a7f88
Fixed broken scanlines effect
brianchirls May 10, 2014
66e4ec0
Changed TV Glitch time to be based on seconds, not milliseconds
brianchirls May 10, 2014
cb56d6d
Added source plugin for THREE.WebGLRenderTarget, with example
brianchirls May 10, 2014
55514b5
Removed unnecessary
brianchirls May 10, 2014
a84d186
Update Source node when src changes #63
brianchirls May 14, 2014
5c59940
Much better unit test for #63
brianchirls May 14, 2014
3044642
Fix: Changing image source now works when new image is the same size #63
brianchirls May 14, 2014
238a9d0
Included three.js so example works
brianchirls May 15, 2014
c58b16b
Fix script inclusions in index.html
brianchirls May 18, 2014
7351e58
Allow effects to become "ready" even if unneeded sources are not ready
brianchirls May 18, 2014
cfd6834
Don't need to resize Select effect and all subsequent nodes on every …
brianchirls May 19, 2014
f842647
Added Fast Approximate Anti-Aliasing (FXAA) effect
brianchirls May 19, 2014
0220817
Bug Fix: incorrect value from checkboxes
brianchirls May 19, 2014
e69f4a7
Auto scaling for Camera Shake #44
brianchirls May 19, 2014
0afe640
Camera Shake has preScale = 1 by default
brianchirls May 30, 2014
410dc4a
Callback function in `go` provides time as first parameter
brianchirls May 30, 2014
948f606
Added Gradient Wipe effect and example
brianchirls May 30, 2014
3d386c5
Modified Exposure effect controls and formula
brianchirls Jul 17, 2014
9338c92
added mirror effect and example
Jul 22, 2014
eb2a5c5
codestyle
Jul 22, 2014
0d5a9a6
codestyle
Jul 22, 2014
4ac64c5
fixed a small bug
Jul 22, 2014
3151fa5
changed examples
Jul 22, 2014
d678f9c
fixed effect algorithm
Jul 23, 2014
8dace0c
Merge branch 'Mirror_effect' of https://github.com/orangecoding/Serio…
Jul 23, 2014
f6336e2
Safer handling of lost context
brianchirls Jul 23, 2014
be3f6b9
Move video source into a plugin
brianchirls Jul 24, 2014
c97c918
Merge pull request #65 from orangecoding/Mirror_effect
brianchirls Jul 25, 2014
bfc1530
Misc. clean-up of Mirror examples
brianchirls Jul 25, 2014
10ba28e
Added Mirror and Color Select to readme
brianchirls Jul 25, 2014
98f2a56
Remove unnecessary `undefined` arguments
brianchirls Jul 25, 2014
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Full documentation is in progress at the [wiki](https://github.com/brianchirls/S
- Color Complements
- Color Generator
- [Color Cube](http://www.youtube.com/watch?v=rfQ8rKGTVlg&t=24m30s)
- Color Select
- [Daltonize](http://www.daltonize.org/p/about.html)
- Directional Blur
- Displacement Map
Expand All @@ -43,6 +44,7 @@ Full documentation is in progress at the [wiki](https://github.com/brianchirls/S
- Expressions
- Fader
- False Color
- Fast Approximate Anti-Aliasing
- Film Grain
- Freeze Frame
- Gaussian Blur
Expand All @@ -54,6 +56,7 @@ Full documentation is in progress at the [wiki](https://github.com/brianchirls/S
- Layers
- Linear Transfer
- Luma Key
- Mirror
- Night Vision
- Panorama
- Polar Coordinates
Expand Down
2 changes: 1 addition & 1 deletion 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, undefined) {
}(this, function (Seriously) {
'use strict';

/*
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, undefined) {
}(this, 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, undefined) {
}(this, function (Seriously) {
'use strict';

/*
Expand Down
7 changes: 7 additions & 0 deletions effects/seriously.blend.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,12 @@
draw(shader, model, uniforms, frameBuffer);
}
},
requires: function (sourceName) {
if (!this.inputs.opacity && sourceName === 'top') {
return false;
}
return true;
},
inputs: {
top: {
type: 'image',
Expand Down Expand Up @@ -527,6 +533,7 @@
defaultValue: 1,
min: 0,
max: 1,
updateSources: true,
update: function (opacity) {
if (topUniforms) {
topUniforms.opacity = opacity;
Expand Down
3 changes: 1 addition & 2 deletions effects/seriously.blur.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ http://v002.info/plugins/v002-blurs/
}
factory(root.Seriously);
}
}(this, function (Seriously, undefined) {
}(this, function (Seriously) {
'use strict';

var passes = [0.2, 0.3, 0.5, 0.8, 1],
Expand Down Expand Up @@ -84,7 +84,6 @@ http://v002.info/plugins/v002-blurs/

shaderSource.vertex = [
defineVaryings,
'#define PI ' + Math.PI,
'precision mediump float;',

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

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

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

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

/* experimental chroma key algorithm
Expand Down
264 changes: 264 additions & 0 deletions effects/seriously.color-select.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
/* global define, require */
(function (root, factory) {
'use strict';

if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['seriously'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS
factory(require('seriously'));
} else {
if (!root.Seriously) {
root.Seriously = { plugin: function (name, opt) { this[name] = opt; } };
}
factory(root.Seriously);
}
}(this, function (Seriously) {
'use strict';

Seriously.plugin('color-select', {
shader: function(inputs, shaderSource, utilities) {
shaderSource.vertex = [
'precision mediump float;',

'attribute vec4 position;',
'attribute vec2 texCoord;',

'uniform vec2 resolution;',
'uniform mat4 transform;',

'uniform float hueMin;',
'uniform float hueMax;',
'uniform float hueMinFalloff;',
'uniform float hueMaxFalloff;',
'uniform float saturationMin;',
'uniform float saturationMax;',
'uniform float saturationMinFalloff;',
'uniform float saturationMaxFalloff;',
'uniform float lightnessMin;',
'uniform float lightnessMax;',
'uniform float lightnessMinFalloff;',
'uniform float lightnessMaxFalloff;',

'varying vec2 vTexCoord;',
'varying vec4 adjustedHueRange;',
'varying vec4 saturationRange;',
'varying vec4 lightnessRange;',

'void main(void) {',
// first convert to screen space
' vec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);',
' screenPosition = transform * screenPosition;',

// convert back to OpenGL coords
' gl_Position.xy = screenPosition.xy * 2.0 / resolution;',
' gl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);',
' gl_Position.w = screenPosition.w;',
' vTexCoord = texCoord;',

' float hueOffset = hueMin - hueMinFalloff;',
' adjustedHueRange = mod(vec4(' +
'hueOffset, ' +
'hueMin - hueOffset, ' +
'hueMax - hueOffset, ' +
'hueMax + hueMaxFalloff - hueOffset' +
'), 360.0);',
' if (hueMin != hueMax) {',
' if (adjustedHueRange.z == 0.0) {',
' adjustedHueRange.z = 360.0;',
' adjustedHueRange.w += 360.0;',
' } else if (adjustedHueRange.w == 0.0) {',
' adjustedHueRange.w += 360.0;',
' }',
' }',
' saturationRange = vec4(' +
'saturationMin - saturationMinFalloff, ' +
'saturationMin, ' +
'saturationMax, ' +
'saturationMax + saturationMaxFalloff ' +
');',

' lightnessRange = vec4(' +
'lightnessMin - lightnessMinFalloff, ' +
'lightnessMin, ' +
'lightnessMax, ' +
'lightnessMax + lightnessMaxFalloff ' +
');',
'}'
].join('\n');

shaderSource.fragment = [
'precision mediump float;',

'varying vec2 vTexCoord;',

'uniform sampler2D source;',
'uniform bool mask;',

'varying vec4 adjustedHueRange;',
'varying vec4 saturationRange;',
'varying vec4 lightnessRange;',

'vec3 calcHSL(vec3 c) {',
' float minColor = min(c.r, min(c.g, c.b));',
' float maxColor = max(c.r, max(c.g, c.b));',
' float delta = maxColor - minColor;',
' vec3 hsl = vec3(0.0, 0.0, (maxColor + minColor) / 2.0);',
' if (delta > 0.0) {',
' if (hsl.z < 0.5) {',
' hsl.y = delta / (maxColor + minColor);',
' } else {',
' hsl.y = delta / (2.0 - maxColor - minColor);',
' }',
' if (c.r == maxColor) {',
' hsl.x = (c.g - c.b) / delta;',
' } else if (c.g == maxColor) {',
' hsl.x = 2.0 + (c.b - c.r) / delta;',
' } else {',
' hsl.x = 4.0 + (c.r - c.g) / delta;',
' }',
' hsl.x = hsl.x * 360.0 / 6.0;',
' if (hsl.x < 0.0) {',
' hsl.x += 360.0;',
' } else {',
' hsl.x = mod(hsl.x, 360.0);',
' }',
' }',
' return hsl;',
'}',

'void main(void) {',
' vec4 color = texture2D(source, vTexCoord);',
' vec3 hsl = calcHSL(color.rgb);',
' float adjustedHue = mod(hsl.x - adjustedHueRange.x, 360.0);',

// calculate hue mask
' float maskValue;',
' if (adjustedHue < adjustedHueRange.y) {',
' maskValue = smoothstep(0.0, adjustedHueRange.y, adjustedHue);',
' } else if (adjustedHue < adjustedHueRange.z) {',
' maskValue = 1.0;',
' } else {',
' maskValue = 1.0 - smoothstep(adjustedHueRange.z, adjustedHueRange.w, adjustedHue);',
' }',

// calculate saturation maskValue
' if (maskValue > 0.0) {',
' if (hsl.y < saturationRange.y) {',
' maskValue = min(maskValue, smoothstep(saturationRange.x, saturationRange.y, hsl.y));',
' } else {',
' maskValue = min(maskValue, 1.0 - smoothstep(saturationRange.z, saturationRange.w, hsl.y));',
' }',
' }',

// calculate lightness maskValue
' if (maskValue > 0.0) {',
' if (hsl.z < lightnessRange.y) {',
' maskValue = min(maskValue, smoothstep(lightnessRange.x, lightnessRange.z, hsl.y));',
' } else {',
' maskValue = min(maskValue, 1.0 - smoothstep(lightnessRange.z, lightnessRange.w, hsl.z));',
' }',
' }',

' if (mask) {',
' gl_FragColor = vec4(maskValue, maskValue, maskValue, 1.0);',
' } else {',
' color.a = min(color.a, maskValue);',
' gl_FragColor = color;',
' }',
'}'
].join('\n');

return shaderSource;
},
inPlace: true,
inputs: {
source: {
type: 'image',
uniform: 'source'
},
hueMin: {
type: 'number',
uniform: 'hueMin',
defaultValue: 0
},
hueMax: {
type: 'number',
uniform: 'hueMax',
defaultValue: 360
},
hueMinFalloff: {
type: 'number',
uniform: 'hueMinFalloff',
defaultValue: 0,
min: 0
},
hueMaxFalloff: {
type: 'number',
uniform: 'hueMaxFalloff',
defaultValue: 0,
min: 0
},
saturationMin: {
type: 'number',
uniform: 'saturationMin',
defaultValue: 0,
min: 0,
max: 1
},
saturationMax: {
type: 'number',
uniform: 'saturationMax',
defaultValue: 1,
min: 0,
max: 1
},
saturationMinFalloff: {
type: 'number',
uniform: 'saturationMinFalloff',
defaultValue: 0,
min: 0
},
saturationMaxFalloff: {
type: 'number',
uniform: 'saturationMaxFalloff',
defaultValue: 0,
min: 0
},
lightnessMin: {
type: 'number',
uniform: 'lightnessMin',
defaultValue: 0,
min: 0,
max: 1
},
lightnessMax: {
type: 'number',
uniform: 'lightnessMax',
defaultValue: 1,
min: 0,
max: 1
},
lightnessMinFalloff: {
type: 'number',
uniform: 'lightnessMinFalloff',
defaultValue: 0,
min: 0
},
lightnessMaxFalloff: {
type: 'number',
uniform: 'lightnessMaxFalloff',
defaultValue: 0,
min: 0
},
mask: {
type: 'boolean',
defaultValue: false,
uniform: 'mask'
}
},
title: 'Color Select',
description: 'Create a mask by hue, saturation and lightness range.'
});
}));
2 changes: 1 addition & 1 deletion effects/seriously.color.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
factory(root.Seriously);
}
}(this, function (Seriously, undefined) {
}(this, function (Seriously) {
'use strict';

Seriously.plugin('color', function () {
Expand Down
Loading