为effect Composer创建GodRays效果过程

Creating a GodRays effect pass for Effect Composer

本文关键字:过程 GodRays 创建 effect Composer      更新时间:2023-09-26

我正试图将god rays演示代码移动到效果生成器中使用的效果传递中,以便更容易与其他后处理效果一起使用。效果的渲染函数没有被调用。。。

我正在以以下格式创建通行证:

THREE.GodRaysPass = function ( width, height, camera, renderer, scene) {
//setup code};
THREE.GodRaysPass.prototype = {
render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) {
//render code
}};

和初始化:

this.composer = new THREE.EffectComposer( this.renderer );
    var effectGodRays = new THREE.GodRaysPass(this.width, this.height, this.camera, this.renderer, this.scene);
    this.composer.addPass( effectGodRays );

EffectComposer在渲染前检查"enabled"属性。切换为true:-)