Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
8bf4f292
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8bf4f292
编写于
9月 18, 2019
作者:
G
Garrett Johnson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix some indents
上级
24dc17b2
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
72 addition
and
72 deletion
+72
-72
examples/js/shaders/BrightnessContrastShader.js
examples/js/shaders/BrightnessContrastShader.js
+9
-9
examples/js/shaders/ColorCorrectionShader.js
examples/js/shaders/ColorCorrectionShader.js
+4
-4
examples/js/shaders/ColorifyShader.js
examples/js/shaders/ColorifyShader.js
+6
-6
examples/js/shaders/ConvolutionShader.js
examples/js/shaders/ConvolutionShader.js
+9
-9
examples/js/shaders/CopyShader.js
examples/js/shaders/CopyShader.js
+4
-4
examples/js/shaders/DigitalGlitch.js
examples/js/shaders/DigitalGlitch.js
+40
-40
未找到文件。
examples/js/shaders/BrightnessContrastShader.js
浏览文件 @
8bf4f292
...
...
@@ -23,9 +23,9 @@ THREE.BrightnessContrastShader = {
"
void main() {
"
,
"
vUv = uv;
"
,
"
vUv = uv;
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
}
"
...
...
@@ -41,15 +41,15 @@ THREE.BrightnessContrastShader = {
"
void main() {
"
,
"
gl_FragColor = texture2D( tDiffuse, vUv );
"
,
"
gl_FragColor = texture2D( tDiffuse, vUv );
"
,
"
gl_FragColor.rgb += brightness;
"
,
"
gl_FragColor.rgb += brightness;
"
,
"
if (contrast > 0.0) {
"
,
"
gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;
"
,
"
} else {
"
,
"
gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;
"
,
"
}
"
,
"
if (contrast > 0.0) {
"
,
"
gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;
"
,
"
} else {
"
,
"
gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;
"
,
"
}
"
,
"
}
"
...
...
examples/js/shaders/ColorCorrectionShader.js
浏览文件 @
8bf4f292
...
...
@@ -21,9 +21,9 @@ THREE.ColorCorrectionShader = {
"
void main() {
"
,
"
vUv = uv;
"
,
"
vUv = uv;
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
}
"
...
...
@@ -40,8 +40,8 @@ THREE.ColorCorrectionShader = {
"
void main() {
"
,
"
gl_FragColor = texture2D( tDiffuse, vUv );
"
,
"
gl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB );
"
,
"
gl_FragColor = texture2D( tDiffuse, vUv );
"
,
"
gl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB );
"
,
"
}
"
...
...
examples/js/shaders/ColorifyShader.js
浏览文件 @
8bf4f292
...
...
@@ -19,8 +19,8 @@ THREE.ColorifyShader = {
"
void main() {
"
,
"
vUv = uv;
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
vUv = uv;
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
}
"
...
...
@@ -35,12 +35,12 @@ THREE.ColorifyShader = {
"
void main() {
"
,
"
vec4 texel = texture2D( tDiffuse, vUv );
"
,
"
vec4 texel = texture2D( tDiffuse, vUv );
"
,
"
vec3 luma = vec3( 0.299, 0.587, 0.114 );
"
,
"
float v = dot( texel.xyz, luma );
"
,
"
vec3 luma = vec3( 0.299, 0.587, 0.114 );
"
,
"
float v = dot( texel.xyz, luma );
"
,
"
gl_FragColor = vec4( v * color, texel.w );
"
,
"
gl_FragColor = vec4( v * color, texel.w );
"
,
"
}
"
...
...
examples/js/shaders/ConvolutionShader.js
浏览文件 @
8bf4f292
...
...
@@ -31,8 +31,8 @@ THREE.ConvolutionShader = {
"
void main() {
"
,
"
vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
}
"
...
...
@@ -49,17 +49,17 @@ THREE.ConvolutionShader = {
"
void main() {
"
,
"
vec2 imageCoord = vUv;
"
,
"
vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );
"
,
"
vec2 imageCoord = vUv;
"
,
"
vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );
"
,
"
for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {
"
,
"
for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {
"
,
"
sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];
"
,
"
imageCoord += uImageIncrement;
"
,
"
sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];
"
,
"
imageCoord += uImageIncrement;
"
,
"
}
"
,
"
}
"
,
"
gl_FragColor = sum;
"
,
"
gl_FragColor = sum;
"
,
"
}
"
...
...
examples/js/shaders/CopyShader.js
浏览文件 @
8bf4f292
...
...
@@ -19,8 +19,8 @@ THREE.CopyShader = {
"
void main() {
"
,
"
vUv = uv;
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
vUv = uv;
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
}
"
...
...
@@ -36,8 +36,8 @@ THREE.CopyShader = {
"
void main() {
"
,
"
vec4 texel = texture2D( tDiffuse, vUv );
"
,
"
gl_FragColor = opacity * texel;
"
,
"
vec4 texel = texture2D( tDiffuse, vUv );
"
,
"
gl_FragColor = opacity * texel;
"
,
"
}
"
...
...
examples/js/shaders/DigitalGlitch.js
浏览文件 @
8bf4f292
...
...
@@ -31,8 +31,8 @@ THREE.DigitalGlitch = {
"
varying vec2 vUv;
"
,
"
void main() {
"
,
"
vUv = uv;
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
vUv = uv;
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
}
"
].
join
(
"
\n
"
),
...
...
@@ -55,47 +55,47 @@ THREE.DigitalGlitch = {
"
float rand(vec2 co){
"
,
"
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
"
,
"
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
"
,
"
}
"
,
"
void main() {
"
,
"
if(byp<1) {
"
,
"
vec2 p = vUv;
"
,
"
float xs = floor(gl_FragCoord.x / 0.5);
"
,
"
float ys = floor(gl_FragCoord.y / 0.5);
"
,
//based on staffantans glitch shader for unity https://github.com/staffantan/unityglitch
"
vec4 normal = texture2D (tDisp, p*seed*seed);
"
,
"
if(p.y<distortion_x+col_s && p.y>distortion_x-col_s*seed) {
"
,
"
if(seed_x>0.){
"
,
"
p.y = 1. - (p.y + distortion_y);
"
,
"
}
"
,
"
else {
"
,
"
p.y = distortion_y;
"
,
"
}
"
,
"
}
"
,
"
if(p.x<distortion_y+col_s && p.x>distortion_y-col_s*seed) {
"
,
"
if(seed_y>0.){
"
,
"
p.x=distortion_x;
"
,
"
}
"
,
"
else {
"
,
"
p.x = 1. - (p.x + distortion_x);
"
,
"
}
"
,
"
}
"
,
"
p.x+=normal.x*seed_x*(seed/5.);
"
,
"
p.y+=normal.y*seed_y*(seed/5.);
"
,
//base from RGB shift shader
"
vec2 offset = amount * vec2( cos(angle), sin(angle));
"
,
"
vec4 cr = texture2D(tDiffuse, p + offset);
"
,
"
vec4 cga = texture2D(tDiffuse, p);
"
,
"
vec4 cb = texture2D(tDiffuse, p - offset);
"
,
"
gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);
"
,
//add noise
"
vec4 snow = 200.*amount*vec4(rand(vec2(xs * seed,ys * seed*50.))*0.2);
"
,
"
gl_FragColor = gl_FragColor+ snow;
"
,
"
}
"
,
"
else {
"
,
"
gl_FragColor=texture2D (tDiffuse, vUv);
"
,
"
}
"
,
"
if(byp<1) {
"
,
"
vec2 p = vUv;
"
,
"
float xs = floor(gl_FragCoord.x / 0.5);
"
,
"
float ys = floor(gl_FragCoord.y / 0.5);
"
,
//based on staffantans glitch shader for unity https://github.com/staffantan/unityglitch
"
vec4 normal = texture2D (tDisp, p*seed*seed);
"
,
"
if(p.y<distortion_x+col_s && p.y>distortion_x-col_s*seed) {
"
,
"
if(seed_x>0.){
"
,
"
p.y = 1. - (p.y + distortion_y);
"
,
"
}
"
,
"
else {
"
,
"
p.y = distortion_y;
"
,
"
}
"
,
"
}
"
,
"
if(p.x<distortion_y+col_s && p.x>distortion_y-col_s*seed) {
"
,
"
if(seed_y>0.){
"
,
"
p.x=distortion_x;
"
,
"
}
"
,
"
else {
"
,
"
p.x = 1. - (p.x + distortion_x);
"
,
"
}
"
,
"
}
"
,
"
p.x+=normal.x*seed_x*(seed/5.);
"
,
"
p.y+=normal.y*seed_y*(seed/5.);
"
,
//base from RGB shift shader
"
vec2 offset = amount * vec2( cos(angle), sin(angle));
"
,
"
vec4 cr = texture2D(tDiffuse, p + offset);
"
,
"
vec4 cga = texture2D(tDiffuse, p);
"
,
"
vec4 cb = texture2D(tDiffuse, p - offset);
"
,
"
gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);
"
,
//add noise
"
vec4 snow = 200.*amount*vec4(rand(vec2(xs * seed,ys * seed*50.))*0.2);
"
,
"
gl_FragColor = gl_FragColor+ snow;
"
,
"
}
"
,
"
else {
"
,
"
gl_FragColor=texture2D (tDiffuse, vUv);
"
,
"
}
"
,
"
}
"
].
join
(
"
\n
"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录