指导你在 IWSDK 项目中实现深度感知遮挡并排查显示异常问题
该技能材料表现为开源仓库中的纯文档/提示型实现指南,不要求密钥、未声明远程端点,也未显示本地执行或数据外发行为。基于现有材料整体风险较低,但仓库社区采用度与维护状态信息有限,供应链维度建议保留基本核验。
材料明确标注无需密钥或环境变量;README 内容仅涉及 WebXR 深度配置与组件注册,未见 token、API key 或账号凭证处理逻辑,凭证泄露/滥用风险低。
未声明任何远程端点,文档内容聚焦设备本地的 WebXR 深度纹理与遮挡渲染;未见将用户数据发送到第三方服务的描述。
系统检查项为 prompt-only,现有材料是使用说明与示例代码片段,不是可执行安装脚本或本机进程控制说明;未见申请额外系统执行权限。
文档描述访问的是 XR 设备提供的深度感知数据,用于本地遮挡效果;未见读写本地文件、访问账号数据或请求与功能无关的过度授权。
正面因素是 GitHub 开源且可审计,且归属 facebook/immersive-web-sdk 仓库,降低了整体风险;但许可证未声明、star 为 0、维护状态未知,仍需在引入前核验仓库活跃度与具体提交内容。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "iwsdk-depth-occlusion" 技能: 1. 下载 https://raw.githubusercontent.com/facebook/immersive-web-sdk/main/packages/starter-assets/claude-injections/skills/iwsdk-depth-occlusion/SKILL.md 2. 保存为 ~/.claude/skills/iwsdk-depth-occlusion/SKILL.md 3. 装好后重载技能,告诉我可以用了
请说明如何在 IWSDK 项目中启用深度感知遮挡,包括需要配置的 DepthSensingSystem、推荐的遮挡模式,以及基础初始化步骤。
给出分步骤的配置说明,帮助在项目中正确启用深度遮挡。
我在做 AR 场景,需要让虚拟物体被真实墙面遮挡。请比较不同 occlusion 模式的适用场景、性能影响和推荐选择。
输出遮挡模式对比与选型建议,便于按场景和性能需求决策。
启用深度遮挡后,我的虚拟物体会完全消失或没有正确被遮挡。请提供系统化排查清单,包含常见原因和修复方法。
返回一份可执行的排查清单,帮助定位配置、渲染或深度数据问题。
Hide virtual objects behind real-world surfaces using WebXR depth sensing. The system samples a per-pixel depth texture from the XR device and compares it against each virtual fragment's depth — if the real surface is closer, the fragment is faded out.
Three things are required: XR session depth config, the system, and the component.
World.create(container, {
xr: {
sessionMode: SessionMode.ImmersiveAR,
referenceSpace: ReferenceSpaceType.Unbounded,
features: {
depthSensing: {
required: true,
usage: 'gpu-optimized', // or 'cpu-optimized'
format: 'float32',
},
hitTest: { required: true },
anchors: { required: true },
unbounded: { required: true },
},
},
});
DepthSensingSystem and DepthOccludableimport { DepthSensingSystem, DepthOccludable } from '@iwsdk/core';
world
.registerSystem(DepthSensingSystem, {
configData: {
enableDepthTexture: true,
enableOcclusion: true,
useFloat32: true,
blurRadius: 20.0,
},
})
.registerComponent(DepthOccludable);
DepthOccludable to entitiesimport { DepthOccludable, OcclusionShadersMode } from '@iwsdk/core';
// Soft occlusion (default) — smooth edges via 13-tap blur
entity.addComponent(DepthOccludable);
// Hard occlusion — sharp edges, single depth sample
entity.addComponent(DepthOccludable, {
mode: OcclusionShadersMode.HardOcclusion,
});
// MinMax occlusion — best quality, extra preprocessing pass
entity.addComponent(DepthOccludable, {
mode: OcclusionShadersMode.MinMaxSoftOcclusion,
});
The material must have transparent: true. The system sets this automatically, but verify it on custom materials.
| Mode | Quality | Cost | Best For |
|---|---|---|---|
SoftOcclusion | Good | Low | Most objects — smooth edges, hides depth aliasing |
HardOcclusion | Basic | Lowest | Small objects or when sharp edges are acceptable |
MinMaxSoftOcclusion | Best | Medium | Large objects with complex silhouettes against varied backgrounds |
| Property | Type | Default | Description |
|---|---|---|---|
enableOcclusion | Boolean | true | Master switch for all occlusion |
enableDepthTexture | Boolean | true | Create GPU textures from depth data |
useFloat32 | Boolean | true | Float32 depth textures (higher precision) |
blurRadius | Float32 | 20.0 | Blur radius for soft occlusion (pixels) |
| Mode | When to use |
|---|---|
cpu-optimized | Simpler, works everywhere. Depth as linear meters in a DataArrayTexture. |
gpu-optimized | Recommended. Matches Quest hardware format. Depth as reverse-Z inverse depth in an ExternalTexture. Required for production parity with on-device behavior. Note that Quest devices only support this mode. |
Depth occlusion only works in AR mode. The scene background must be null for passthrough:
scene.background = null;
Objects never occlude (always visible on top)
DepthOccludable componentDepthSensingSystem is registered with enableOcclusion: truedepthSensing is in the XR features configObjects always invisible in IWER
Flickering or noisy occlusion edges
blurRadius (try 30-40)HardOcclusion to SoftOcclusionMinMaxSoftOcclusion for best edge qualitySessionMode.ImmersiveAR with depthSensing in features.…
帮助规划 IWSDK 新功能、系统架构与代码模式,并提供最佳实践建议。
帮助开发者用 iwsdk CLI 测试 XR 交互与面板音频行为是否正常。
用于逐帧调试 WebXR 场景中的物理、动画与实时交互行为。
使用 iwsdk CLI 测试 Havok 物理系统的重力与刚体行为表现
在 WebXR 场景中模拟抓取物体,便于交互测试与搬运操作验证。
在 XR 场景中定位并点击目标对象,用于验证按钮与交互元素是否正常工作
指导在 IWSDK 项目中实现物理模拟、交互物体与碰撞调试。
使用 iwsdk CLI 对关卡层级、标签与默认灯光配置进行测试验证。
帮助你创建、修改、调试并预览 IWSDK 应用中的 PanelUI 界面组件。
使用 iwsdk CLI 对比示例场景,测试滑动、瞬转、传送与跳跃移动系统。
使用 iwsdk CLI 测试抓取系统的多种交互抓取模式
使用 iwsdk CLI 针对 poke 示例验证环境系统与组件配置是否正常