ThreeJS:透明背景与散景着色器

时间:2017-10-07 11:56:59

标签: javascript three.js webgl

我在画布上应用了景/景深。工作正常,但为了将来的需要,我需要添加CSS背景。这就是我需要透明的原因。

我使用了这个例子中的代码:
https://threejs.org/examples/webgl_postprocessing_dof.html

以下是现在的样子:
http://normanwink.com/demo/bokeh/
您会注意到黑色背景,但身体设置为深灰色;点击右下方的“添加”按钮。

我创建了一个Codepen,以便更轻松地访问代码 不幸的是,我无法让它运行 仍然:https://codepen.io/normanwink/pen/gGvQgo

我看了一下RenderPass.js

THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clearAlpha ) {

    THREE.Pass.call( this );

    this.scene = scene;
    this.camera = camera;

    this.overrideMaterial = overrideMaterial;

    this.clearColor = clearColor;
    this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;

    this.clear = true;
    this.clearDepth = false;
    this.needsSwap = false;

};

这看起来很有希望,但我不确切知道该做什么。

  • ThreeJS r87

谢谢!

0 个答案:

没有答案
相关问题