You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WebGPU示例项目中立方体两个面始终显示为黑色的问题求助

WebGPU示例项目中立方体两个面始终显示为黑色的问题求助

Simple cube with simple uv made in blender

我遇到了一个棘手的问题:基于WebGPU示例项目制作的立方体,总有两个面一直呈现黑色状态。就算我把着色器里的阴影效果去掉,这两个面还是没法正常清晰显示。

我尝试过调整光源的位置,但对应图片里类似骰子3和5的那两个面,依旧是黑色的。有没有大佬能给我一些解决建议呀?

export let fragmentWGSL = `override shadowDepthTextureSize: f32 = 1024.0;

struct Scene {
  lightViewProjMatrix : mat4x4f,
  cameraViewProjMatrix : mat4x4f,
  lightPos : vec3f,
}

@group(0) @binding(0) var<uniform> scene : Scene;
@group(0) @binding(1) var shadowMap: texture_depth_2d;
@group(0) @binding(2) var shadowSampler: sampler_comparison;
@group(0) @binding(3) var meshTexture: texture_2d<f32>;
@group(0) @binding(4) var meshSampler: sampler;

struct FragmentInput {
  @location(0) shadowPos : vec3f,
  @location(1) fragPos : vec3f,
  @location(2) fragNorm ...
`

备注:内容来源于stack exchange,提问作者Nikola Lukic

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.17 10:38:05