mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2025-01-03 08:33:48 +01:00
move shaders
This commit is contained in:
parent
af9c06749c
commit
ead9dd1cb6
@ -1,4 +1,3 @@
|
|||||||
export default `
|
|
||||||
uniform sampler2D tDiffuse;
|
uniform sampler2D tDiffuse;
|
||||||
uniform sampler2D tNormal;
|
uniform sampler2D tNormal;
|
||||||
uniform sampler2D tDepth;
|
uniform sampler2D tDepth;
|
||||||
@ -15,4 +14,3 @@ void main() {
|
|||||||
|
|
||||||
gl_FragColor = mix(max(colorDiffuse - colorDepth - colorNormal, 0.0), colorUI, colorUI.w);
|
gl_FragColor = mix(max(colorDiffuse - colorDepth - colorNormal, 0.0), colorUI, colorUI.w);
|
||||||
}
|
}
|
||||||
`;
|
|
@ -1,4 +1,3 @@
|
|||||||
export default `
|
|
||||||
uniform float mNear;
|
uniform float mNear;
|
||||||
uniform float mFar;
|
uniform float mFar;
|
||||||
uniform float opacity;
|
uniform float opacity;
|
||||||
@ -13,4 +12,3 @@ void main() {
|
|||||||
float color = 1.0 - smoothstep( mNear, mFar, depth );
|
float color = 1.0 - smoothstep( mNear, mFar, depth );
|
||||||
gl_FragColor = vec4( vec3( color ), opacity );
|
gl_FragColor = vec4( vec3( color ), opacity );
|
||||||
}
|
}
|
||||||
`;
|
|
@ -1,4 +1,3 @@
|
|||||||
export default `
|
|
||||||
uniform sampler2D tDiffuse;
|
uniform sampler2D tDiffuse;
|
||||||
uniform float threshold;
|
uniform float threshold;
|
||||||
uniform vec2 aspect;
|
uniform vec2 aspect;
|
||||||
@ -25,4 +24,3 @@ void main() {
|
|||||||
|
|
||||||
gl_FragColor = (length(sobel) > threshold) ? vec4(vec3(1.0), 0.0) : vec4(0.0);
|
gl_FragColor = (length(sobel) > threshold) ? vec4(vec3(1.0), 0.0) : vec4(0.0);
|
||||||
}
|
}
|
||||||
`;
|
|
@ -1,4 +1,3 @@
|
|||||||
export default `
|
|
||||||
// edge detection based on http://williamchyr.com/tag/unity/page/2/
|
// edge detection based on http://williamchyr.com/tag/unity/page/2/
|
||||||
uniform sampler2D tDiffuse;
|
uniform sampler2D tDiffuse;
|
||||||
uniform float threshold;
|
uniform float threshold;
|
||||||
@ -20,4 +19,3 @@ void main() {
|
|||||||
|
|
||||||
gl_FragColor = difference > threshold ? vec4(vec3(1.0), 0.0) : vec4(0.0);
|
gl_FragColor = difference > threshold ? vec4(vec3(1.0), 0.0) : vec4(0.0);
|
||||||
}
|
}
|
||||||
`;
|
|
@ -1,4 +1,3 @@
|
|||||||
export default `
|
|
||||||
// edge detection based on http://williamchyr.com/tag/unity/page/2/
|
// edge detection based on http://williamchyr.com/tag/unity/page/2/
|
||||||
uniform sampler2D tDiffuse;
|
uniform sampler2D tDiffuse;
|
||||||
uniform float threshold;
|
uniform float threshold;
|
||||||
@ -19,4 +18,3 @@ void main() {
|
|||||||
|
|
||||||
gl_FragColor = difference > threshold ? vec4(vec3(1.0), 0.0) : vec4(0.0);
|
gl_FragColor = difference > threshold ? vec4(vec3(1.0), 0.0) : vec4(0.0);
|
||||||
}
|
}
|
||||||
`;
|
|
@ -1,4 +1,3 @@
|
|||||||
export default `
|
|
||||||
varying float vFragDepth;
|
varying float vFragDepth;
|
||||||
uniform float logDepthBufFC;
|
uniform float logDepthBufFC;
|
||||||
|
|
||||||
@ -13,4 +12,3 @@ void main() {
|
|||||||
// gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;
|
// gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;
|
||||||
vFragDepth = 1.0 + gl_Position.w;
|
vFragDepth = 1.0 + gl_Position.w;
|
||||||
}
|
}
|
||||||
`;
|
|
@ -1,8 +1,6 @@
|
|||||||
export default `
|
|
||||||
varying vec2 vUv;
|
varying vec2 vUv;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vUv = uv;
|
vUv = uv;
|
||||||
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
||||||
}
|
}
|
||||||
`;
|
|
12
src/d3/ToonShaderRenderChain.js
vendored
12
src/d3/ToonShaderRenderChain.js
vendored
@ -3,12 +3,12 @@ import 'three/examples/js/postprocessing/EffectComposer.js';
|
|||||||
import 'three/examples/js/postprocessing/RenderPass.js';
|
import 'three/examples/js/postprocessing/RenderPass.js';
|
||||||
import 'three/examples/js/postprocessing/ShaderPass.js';
|
import 'three/examples/js/postprocessing/ShaderPass.js';
|
||||||
import 'three/examples/js/shaders/CopyShader.js';
|
import 'three/examples/js/shaders/CopyShader.js';
|
||||||
import vertexShaderPostprocessing from './shaders/vertexShaderPostprocessing.js';
|
import vertexShaderPostprocessing from '../../shaders/vertexShaderPostprocessing.glsl';
|
||||||
import fragmentShaderSobelDepth from './shaders/fragmentShaderSobelDepth.js';
|
import fragmentShaderSobelDepth from '../../shaders/fragmentShaderSobelDepth.glsl';
|
||||||
import fragmentShaderSobelNormal from './shaders/fragmentShaderSobelNormal.js';
|
import fragmentShaderSobelNormal from '../../shaders/fragmentShaderSobelNormal.glsl';
|
||||||
import fragmentShaderCombineTextures from './shaders/fragmentShaderCombineTextures.js';
|
import fragmentShaderCombineTextures from '../../shaders/fragmentShaderCombineTextures.glsl';
|
||||||
import fragmentShaderDepth from './shaders/fragmentShaderDepth.js';
|
import fragmentShaderDepth from '../../shaders/fragmentShaderDepth.glsl';
|
||||||
import vertexShaderDepth from './shaders/vertexShaderDepth.js';
|
import vertexShaderDepth from '../../shaders/vertexShaderDepth.glsl';
|
||||||
|
|
||||||
// Based on Doodle3D/Toon-Shader
|
// Based on Doodle3D/Toon-Shader
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
test: /\.svg$/,
|
test: /\.(svg|glsl)$/,
|
||||||
use: {
|
use: {
|
||||||
loader: 'raw-loader'
|
loader: 'raw-loader'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user