围绕渲染图像的实用工具:通过任意相机以选定尺寸截取场景截图,作为可使用的图像数据 URL 或作为下载。
以给定尺寸通过 camera(未给出时为活动相机)渲染场景,并以数据 URL 返回图像。
camera
mimeType 选择格式,quality 从 0 到 1 设置 JPEG 等有损格式的压缩程度。
mimeType
quality
相机、尺寸、图像类型和质量
以数据 URL 表示的图像
const image = await bitbybit.babylon.tools.createScreenshot({ camera: bitbybit.babylon.scene.getActiveCamera(), width: 1920, height: 1080, mimeType: "image/png", quality: 1 }); Copy
const image = await bitbybit.babylon.tools.createScreenshot({ camera: bitbybit.babylon.scene.getActiveCamera(), width: 1920, height: 1080, mimeType: "image/png", quality: 1 });
以给定尺寸通过 camera(未给出时为活动相机)渲染场景,并在浏览器中下载图像。
下载开始后返回文本 done
done
await bitbybit.babylon.tools.createScreenshotAndDownload({ camera: bitbybit.babylon.scene.getActiveCamera(), width: 1920, height: 1080, mimeType: "image/png", quality: 1 }); Copy
await bitbybit.babylon.tools.createScreenshotAndDownload({ camera: bitbybit.babylon.scene.getActiveCamera(), width: 1920, height: 1080, mimeType: "image/png", quality: 1 });
Namespace: Bit
Other top-level symbols:
API reference home · Full symbol index · Tutorials and guides · Platform
围绕渲染图像的实用工具:通过任意相机以选定尺寸截取场景截图,作为可使用的图像数据 URL 或作为下载。