0

我想为 THREE.js 中的效果为渲染帧生成自定义 mip 贴图,但不清楚如何实现。我想在每一帧之后再次重新生成 mip 贴图。

此示例展示了如何为纹理生成 mipmap,但看起来该mipmaps数组需要一个imagecanvas标记的句柄,而 renderTarget 纹理没有。理想情况下,我希望能够做这样的事情:

var rt = new THREE.WebGLRenderTarget()

// initialize and render to the target

var mipmaps = [];
var width = rt.width / 2;
var height = rt.height / 2;

while( width > 2 && height > 2) {

    var mip = new THREE.WebGLRenderTarget({ width, height });
    mipmaps.push(mip.texture); // mip.texture.image === undefined

    // render to the new mipmap with a custom downsample shader

    width /= 2;
    height /= 2;
}

rt.texture.mipmaps = mipmaps;

// render using the original render target as a texture map and using
// the new mip maps as needed

这可能吗?我将如何实现这一目标?

谢谢!

4

0 回答 0