Skip to content

Commit 5310f37

Browse files
committed
Version 4.3.1.
1 parent 026efca commit 5310f37

File tree

5 files changed

+61
-55
lines changed

5 files changed

+61
-55
lines changed

build/postprocessing.js

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* postprocessing v4.3.0 build Feb 17 2018
2+
* postprocessing v4.3.1 build Feb 24 2018
33
* https://github.com/vanruesc/postprocessing
44
* Copyright 2018 Raoul van Rüschen, Zlib
55
*/
@@ -391,9 +391,9 @@
391391
return CopyMaterial;
392392
}(three.ShaderMaterial);
393393

394-
var fragment$6 = "#include <packing>\r\n\r\nuniform sampler2D tDepth;\r\nuniform float cameraNear;\r\nuniform float cameraFar;\r\n\r\nvarying float vViewZ;\r\nvarying vec4 vProjTexCoord;\r\n\r\nvoid main() {\r\n\r\n\t// Transform into Cartesian coordinate (not mirrored).\r\n\tvec2 projTexCoord = (vProjTexCoord.xy / vProjTexCoord.w) * 0.5 + 0.5;\r\n\tprojTexCoord = clamp(projTexCoord, 0.002, 0.998);\r\n\r\n\tfloat fragCoordZ = unpackRGBAToDepth(texture2D(tDepth, projTexCoord));\r\n\r\n\t#ifdef PERSPECTIVE_CAMERA\r\n\r\n\t\tfloat viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\r\n\r\n\t#else\r\n\r\n\t\tfloat viewZ = orthographicDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\r\n\r\n\t#endif\r\n\r\n\tfloat depthTest = (vViewZ <= viewZ) ? 1.0 : 0.0;\r\n\r\n\tgl_FragColor.rgb = vec3(0.0, depthTest, 1.0);\r\n\r\n}\r\n";
394+
var fragment$6 = "#include <packing>\r\n#include <clipping_planes_pars_fragment>\r\n\r\nuniform sampler2D tDepth;\r\nuniform float cameraNear;\r\nuniform float cameraFar;\r\n\r\nvarying float vViewZ;\r\nvarying vec4 vProjTexCoord;\r\n\r\nvoid main() {\r\n\r\n\t#include <clipping_planes_fragment>\r\n\r\n\t// Transform into Cartesian coordinate (not mirrored).\r\n\tvec2 projTexCoord = (vProjTexCoord.xy / vProjTexCoord.w) * 0.5 + 0.5;\r\n\tprojTexCoord = clamp(projTexCoord, 0.002, 0.998);\r\n\r\n\tfloat fragCoordZ = unpackRGBAToDepth(texture2D(tDepth, projTexCoord));\r\n\r\n\t#ifdef PERSPECTIVE_CAMERA\r\n\r\n\t\tfloat viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\r\n\r\n\t#else\r\n\r\n\t\tfloat viewZ = orthographicDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\r\n\r\n\t#endif\r\n\r\n\tfloat depthTest = (vViewZ <= viewZ) ? 1.0 : 0.0;\r\n\r\n\tgl_FragColor.rgb = vec3(0.0, depthTest, 1.0);\r\n\r\n}\r\n";
395395

396-
var vertex$6 = "varying float vViewZ;\r\nvarying vec4 vProjTexCoord;\r\n\r\nvoid main() {\r\n\r\n\tvec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\r\n\tvProjTexCoord = projectionMatrix * mvPosition;\r\n\tvViewZ = mvPosition.z;\r\n\r\n\tgl_Position = vProjTexCoord;\r\n\r\n}\r\n";
396+
var vertex$6 = "#include <common>\r\n#include <morphtarget_pars_vertex>\r\n#include <skinning_pars_vertex>\r\n#include <clipping_planes_pars_vertex>\r\n\r\nvarying float vViewZ;\r\nvarying vec4 vProjTexCoord;\r\n\r\nvoid main() {\r\n\r\n\t#include <skinbase_vertex>\r\n\r\n\t#include <begin_vertex>\r\n\t#include <morphtarget_vertex>\r\n\t#include <skinning_vertex>\r\n\t#include <project_vertex>\r\n\r\n\tvViewZ = mvPosition.z;\r\n\tvProjTexCoord = gl_Position;\r\n\r\n\t#include <clipping_planes_vertex>\r\n\r\n}\r\n";
397397

398398
var DepthComparisonMaterial = function (_ShaderMaterial) {
399399
inherits(DepthComparisonMaterial, _ShaderMaterial);
@@ -419,7 +419,10 @@
419419
vertexShader: vertex$6,
420420

421421
depthWrite: false,
422-
depthTest: false
422+
depthTest: false,
423+
424+
morphTargets: true,
425+
skinning: true
423426

424427
}));
425428

@@ -862,7 +865,7 @@
862865
return LuminosityMaterial;
863866
}(three.ShaderMaterial);
864867

865-
var fragment$12 = "uniform sampler2D tDiffuse;\r\nuniform sampler2D tMask;\r\nuniform sampler2D tOutline;\r\n\r\nuniform vec3 visibleEdgeColor;\r\nuniform vec3 hiddenEdgeColor;\r\nuniform float pulse;\r\nuniform float edgeStrength;\r\n\r\n#ifdef USE_PATTERN\r\n\r\n\tuniform sampler2D tPattern;\r\n\tvarying vec2 vPatternCoord;\r\n\r\n#endif\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvec4 color = texture2D(tDiffuse, vUv);\r\n\tvec2 outline = texture2D(tOutline, vUv).rg;\r\n\tvec2 mask = texture2D(tMask, vUv).rg;\r\n\r\n\t#ifndef X_RAY\r\n\r\n\t\toutline.y = 0.0;\r\n\r\n\t#endif\r\n\r\n\toutline *= (edgeStrength * mask.x * pulse);\r\n\tvec3 outlineColor = outline.x * visibleEdgeColor + outline.y * hiddenEdgeColor;\r\n\r\n\t#ifdef ALPHA_BLENDING\r\n\r\n\t\tcolor.rgb = mix(color.rgb, outlineColor, max(outline.x, outline.y));\r\n\r\n\t#else\r\n\r\n\t\tcolor.rgb += outlineColor;\r\n\r\n\t#endif\r\n\r\n\t#ifdef USE_PATTERN\r\n\r\n\t\tvec3 patternColor = texture2D(tPattern, vPatternCoord).rgb;\r\n\r\n\t\t#ifdef X_RAY\r\n\r\n\t\t\tfloat hiddenFactor = 0.5;\r\n\r\n\t\t#else\r\n\r\n\t\t\tfloat hiddenFactor = 0.0;\r\n\r\n\t\t#endif\r\n\r\n\t\tfloat visibilityFactor = (1.0 - mask.y > 0.0) ? 1.0 : hiddenFactor;\r\n\r\n\t\tcolor.rgb += visibilityFactor * (1.0 - mask.x) * (1.0 - patternColor);\r\n\r\n\t#endif\r\n\r\n\tgl_FragColor = color;\r\n\r\n}\r\n";
868+
var fragment$12 = "uniform sampler2D tDiffuse;\r\nuniform sampler2D tMask;\r\nuniform sampler2D tEdges;\r\n\r\nuniform vec3 visibleEdgeColor;\r\nuniform vec3 hiddenEdgeColor;\r\nuniform float pulse;\r\nuniform float edgeStrength;\r\n\r\n#ifdef USE_PATTERN\r\n\r\n\tuniform sampler2D tPattern;\r\n\tvarying vec2 vPatternCoord;\r\n\r\n#endif\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvec4 color = texture2D(tDiffuse, vUv);\r\n\tvec2 edge = texture2D(tEdges, vUv).rg;\r\n\tvec2 mask = texture2D(tMask, vUv).rg;\r\n\r\n\t#ifndef X_RAY\r\n\r\n\t\toutline.y = 0.0;\r\n\r\n\t#endif\r\n\r\n\tedge *= (edgeStrength * mask.x * pulse);\r\n\tvec3 outlineColor = edge.x * visibleEdgeColor + edge.y * hiddenEdgeColor;\r\n\r\n\t#ifdef ALPHA_BLENDING\r\n\r\n\t\tcolor.rgb = mix(color.rgb, outlineColor, max(edge.x, edge.y));\r\n\r\n\t#else\r\n\r\n\t\tcolor.rgb += outlineColor;\r\n\r\n\t#endif\r\n\r\n\t#ifdef USE_PATTERN\r\n\r\n\t\tvec3 patternColor = texture2D(tPattern, vPatternCoord).rgb;\r\n\r\n\t\t#ifdef X_RAY\r\n\r\n\t\t\tfloat hiddenFactor = 0.5;\r\n\r\n\t\t#else\r\n\r\n\t\t\tfloat hiddenFactor = 0.0;\r\n\r\n\t\t#endif\r\n\r\n\t\tfloat visibilityFactor = (1.0 - mask.y > 0.0) ? 1.0 : hiddenFactor;\r\n\r\n\t\tcolor.rgb += visibilityFactor * (1.0 - mask.x) * (1.0 - patternColor);\r\n\r\n\t#endif\r\n\r\n\tgl_FragColor = color;\r\n\r\n}\r\n";
866869

867870
var vertex$12 = "#ifdef USE_PATTERN\r\n\r\n\tuniform float aspect;\r\n\tuniform float patternScale;\r\n\tvarying vec2 vPatternCoord;\r\n\r\n#endif\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\t#ifdef USE_PATTERN\r\n\r\n\t\tvec2 aspectCorrection = vec2(aspect, 1.0);\r\n\t\tvPatternCoord = uv * aspectCorrection * patternScale;\r\n\r\n\t#endif\r\n\r\n\tvUv = uv;\r\n\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";
868871

@@ -894,7 +897,7 @@
894897

895898
tDiffuse: new three.Uniform(null),
896899
tMask: new three.Uniform(null),
897-
tOutline: new three.Uniform(null),
900+
tEdges: new three.Uniform(null),
898901
tPattern: new three.Uniform(null),
899902

900903
edgeStrength: new three.Uniform(settings.edgeStrength),
@@ -968,7 +971,7 @@
968971
return OutlineBlendMaterial;
969972
}(three.ShaderMaterial);
970973

971-
var fragment$13 = "uniform sampler2D tMask;\r\n\r\nvarying vec2 vUv0;\r\nvarying vec2 vUv1;\r\nvarying vec2 vUv2;\r\nvarying vec2 vUv3;\r\n\r\nvoid main() {\r\n\r\n\tvec2 c0 = texture2D(tMask, vUv0).rg;\r\n\tvec2 c1 = texture2D(tMask, vUv1).rg;\r\n\tvec2 c2 = texture2D(tMask, vUv2).rg;\r\n\tvec2 c3 = texture2D(tMask, vUv3).rg;\r\n\r\n\tfloat d0 = (c0.x - c1.x) * 0.5;\r\n\tfloat d1 = (c2.x - c3.x) * 0.5;\r\n\tfloat d = length(vec2(d0, d1));\r\n\r\n\tfloat a0 = min(c0.y, c1.y);\r\n\tfloat a1 = min(c2.y, c3.y);\r\n\tfloat visibilityFactor = min(a0, a1);\r\n\r\n\tvec3 edgeColor = (1.0 - visibilityFactor > 0.001) ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\r\n\r\n\tgl_FragColor = vec4(edgeColor * d, d);\r\n\r\n}\r\n";
974+
var fragment$13 = "uniform sampler2D tMask;\r\n\r\nvarying vec2 vUv0;\r\nvarying vec2 vUv1;\r\nvarying vec2 vUv2;\r\nvarying vec2 vUv3;\r\n\r\nvoid main() {\r\n\r\n\tvec2 c0 = texture2D(tMask, vUv0).rg;\r\n\tvec2 c1 = texture2D(tMask, vUv1).rg;\r\n\tvec2 c2 = texture2D(tMask, vUv2).rg;\r\n\tvec2 c3 = texture2D(tMask, vUv3).rg;\r\n\r\n\tfloat d0 = (c0.x - c1.x) * 0.5;\r\n\tfloat d1 = (c2.x - c3.x) * 0.5;\r\n\tfloat d = length(vec2(d0, d1));\r\n\r\n\tfloat a0 = min(c0.y, c1.y);\r\n\tfloat a1 = min(c2.y, c3.y);\r\n\tfloat visibilityFactor = min(a0, a1);\r\n\r\n\tgl_FragColor.rg = (1.0 - visibilityFactor > 0.001) ? vec2(d, 0.0) : vec2(0.0, d);\r\n\r\n}\r\n";
972975

973976
var vertex$13 = "uniform vec2 texelSize;\r\n\r\nvarying vec2 vUv0;\r\nvarying vec2 vUv1;\r\nvarying vec2 vUv2;\r\nvarying vec2 vUv3;\r\n\r\nvoid main() {\r\n\r\n\tvUv0 = vec2(uv.x + texelSize.x, uv.y);\r\n\tvUv1 = vec2(uv.x - texelSize.x, uv.y);\r\n\tvUv2 = vec2(uv.x, uv.y + texelSize.y);\r\n\tvUv3 = vec2(uv.x, uv.y - texelSize.y);\r\n\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";
974977

@@ -2539,32 +2542,38 @@
25392542

25402543
_this.renderTargetDepth = new three.WebGLRenderTarget(1, 1, {
25412544
minFilter: three.LinearFilter,
2542-
magFilter: three.LinearFilter
2545+
magFilter: three.LinearFilter,
2546+
format: three.RGBFormat
25432547
});
25442548

2545-
_this.renderTargetDepth.texture.name = "GodRays.Depth";
2549+
_this.renderTargetDepth.texture.name = "Outline.Depth";
25462550
_this.renderTargetDepth.texture.generateMipmaps = false;
25472551

25482552
_this.renderTargetMask = _this.renderTargetDepth.clone();
25492553

2550-
_this.renderTargetMask.texture.name = "GodRays.Mask";
2554+
_this.renderTargetMask.texture.name = "Outline.Mask";
25512555

25522556
_this.renderTargetEdges = new three.WebGLRenderTarget(1, 1, {
25532557
minFilter: three.LinearFilter,
25542558
magFilter: three.LinearFilter,
25552559
stencilBuffer: false,
2556-
depthBuffer: false
2560+
depthBuffer: false,
2561+
format: three.RGBFormat
25572562
});
25582563

2559-
_this.renderTargetEdges.texture.name = "GodRays.Edges";
2564+
_this.renderTargetEdges.texture.name = "Outline.Edges";
25602565
_this.renderTargetEdges.texture.generateMipmaps = false;
25612566

2562-
_this.renderTargetOutline = _this.renderTargetEdges.clone();
2567+
_this.renderTargetBlurredEdges = _this.renderTargetEdges.clone();
25632568

2564-
_this.renderTargetOutline.texture.name = "GodRays.Outline";
2569+
_this.renderTargetBlurredEdges.texture.name = "Outline.BlurredEdges";
25652570

25662571
_this.renderPassDepth = new RenderPass(_this.mainScene, _this.mainCamera, {
2567-
overrideMaterial: new three.MeshDepthMaterial({ depthPacking: three.RGBADepthPacking }),
2572+
overrideMaterial: new three.MeshDepthMaterial({
2573+
depthPacking: three.RGBADepthPacking,
2574+
morphTargets: true,
2575+
skinning: true
2576+
}),
25682577
clearColor: new three.Color(0xffffff),
25692578
clearAlpha: 1.0
25702579
});
@@ -2590,7 +2599,8 @@
25902599

25912600
_this.outlineBlendMaterial = new OutlineBlendMaterial(options);
25922601
_this.outlineBlendMaterial.uniforms.tMask.value = _this.renderTargetMask.texture;
2593-
_this.outlineBlendMaterial.uniforms.tOutline.value = _this.renderTargetOutline.texture;
2602+
2603+
_this.blur = options.blur !== undefined ? options.blur : true;
25942604

25952605
_this.selection = [];
25962606

@@ -2743,7 +2753,7 @@
27432753
renderer.render(this.scene, this.camera, this.renderTargetEdges);
27442754

27452755
if (this.blurPass.enabled) {
2746-
this.blurPass.render(renderer, this.renderTargetEdges, this.renderTargetOutline);
2756+
this.blurPass.render(renderer, this.renderTargetEdges, this.renderTargetBlurredEdges);
27472757
}
27482758

27492759
this.quad.material = this.outlineBlendMaterial;
@@ -2760,13 +2770,6 @@
27602770
this.renderPassDepth.initialize(renderer, alpha);
27612771
this.renderPassMask.initialize(renderer, alpha);
27622772
this.blurPass.initialize(renderer, alpha);
2763-
2764-
if (!alpha) {
2765-
2766-
this.renderTargetMask.texture.format = three.RGBFormat;
2767-
this.renderTargetEdges.texture.format = three.RGBFormat;
2768-
this.renderTargetOutline.texture.format = three.RGBFormat;
2769-
}
27702773
}
27712774
}, {
27722775
key: "setSize",
@@ -2783,7 +2786,7 @@
27832786
height = this.blurPass.height;
27842787

27852788
this.renderTargetEdges.setSize(width, height);
2786-
this.renderTargetOutline.setSize(width, height);
2789+
this.renderTargetBlurredEdges.setSize(width, height);
27872790

27882791
this.outlineBlendMaterial.uniforms.aspect.value = width / height;
27892792
this.outlineEdgesMaterial.setTexelSize(1.0 / width, 1.0 / height);
@@ -2822,7 +2825,7 @@
28222825

28232826
this.blurPass.enabled = value;
28242827

2825-
this.outlineBlendMaterial.uniforms.tOutline.value = value ? this.renderTargetOutline.texture : this.renderTargetEdges.texture;
2828+
this.outlineBlendMaterial.uniforms.tEdges.value = value ? this.renderTargetBlurredEdges.texture : this.renderTargetEdges.texture;
28262829
}
28272830
}, {
28282831
key: "dithering",

build/postprocessing.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postprocessing",
3-
"version": "4.3.0",
3+
"version": "4.3.1",
44
"description": "A post processing library that provides the means to implement image filter effects for three.js.",
55
"homepage": "https://github.com/vanruesc/postprocessing",
66
"main": "build/postprocessing.js",

0 commit comments

Comments
 (0)