Orillusion

    • 注册
    • 登录
    • 搜索
    • 版块
    • 最新
    • 标签

    使用 copyTextureToTexture可以将多个渲染结果copy到一个纹理上吗?

    中文社区
    帧缓冲
    2
    4
    82
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • zhoubin10
      zhoubin10 最后由 shuangliu 编辑

      for (var i = 0; i < 6; ++i) {
          const renderPassDescriptor = {
              colorAttachments: [
                  {
                      view: renderView,
                      clearValue: { r: 0, g: 0, b: 0, a: 1.0 },
                      loadOp: "clear",
                      storeOp: "store",
                  },
              ],
              depthStencilAttachment: {
                  view: depthView,
                  depthClearValue: 1.0,
                  depthLoadOp: "clear",
                  depthStoreOp: "store",
              },
          };
          const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor);
          passEncoder.setPipeline(pipeline);
      
          passEncoder.setVertexBuffer(0, positionBuffer);
          passEncoder.setIndexBuffer(indicesBuffer, "uint32");
          passEncoder.setBindGroup(0, vertexBindGroup);
          passEncoder.setBindGroup(1, fragmentBindGroup);
          passEncoder.drawIndexed(indices.length, 1, 0, 0);
          passEncoder.end();
          commandEncoder.copyTextureToTexture(
              {
                  texture: renderTexture,
              },
              {
                  texture: cubeMap,
                  origin: [0, 0, i],
              },
              [1024, 1024]
          );
      }
      
      shuangliu 1 条回复 最后回复 回复 引用 0
      • shuangliu
        shuangliu @zhoubin10 最后由 shuangliu 编辑

        @zhoubin10 不确定你的代码是否正确,但可以使用 for 循环进行 copyTextureToTexture 这种的操作,将多个贴图进行混合,确实可以用作生成 mipmap

        zhoubin10 1 条回复 最后回复 回复 引用 0
        • zhoubin10
          zhoubin10 @shuangliu 最后由 编辑

          @shuangliu 请问有没有相关的案例?

          shuangliu 1 条回复 最后回复 回复 引用 0
          • shuangliu
            shuangliu @zhoubin10 最后由 编辑

            @zhoubin10 很多经典的案例,比如 https://github.com/toji/web-texture-tool/blob/main/src/webgpu-mipmap-generator.js

            1 条回复 最后回复 回复 引用 0
            • First post
              Last post

            Recent Post

            • 目前可以预览demo了

              • 阅读更多
            • A

              这demo太卡了,我机器性能不算差,运行个demo cpu就将近100%

              • 阅读更多
            • A

              没有贴出app.vue的代码

              • 阅读更多
            • @aichangqing 可能是之前版本的cdn缓存没更新,可以清理本地缓存刷新再试一次

              • 阅读更多
            • 36e6af78-b023-4031-9b56-bd8713b44393-image.png

              已经是版本 113.0.5656.0(正式版本)canary (64 位)并且开启chrome://flags/#enable-unsafe-webgpu 为enable,为啥还不能预览demo

              • 阅读更多

            Copyright © 2022 Orillusion | Contact US