SceneKit AVPlayer 仅播放音频

SceneKit AVPlayer only audio is playing

我正在尝试播放 SceneKit 中的视频。我可以听到音频,但无法呈现视频。我使用场景的方式如下。请帮忙

SCNScene *scene = [SCNScene sceneNamed:@"art.scnassets/plane.scn"];
SCNNode *plane = [scene.rootNode childNodeWithName:@"plane" recursively:YES];

AVPlayer *player = [AVPlayer playerWithURL:[NSURL URLWithString:@"https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_5mb.mp4"]];
plane.geometry.firstMaterial.diffuse.contents = player;
[player play];

SCNView *scnView = (SCNView *)self.view;
scnView.scene = scene;
scnView.allowsCameraControl = YES;
scnView.showsStatistics = YES;
scnView.backgroundColor = [UIColor blackColor];

您需要使用真实的iPhone而非模拟器才能享受。

另一个原因是 material 面板中的阴影不应基于物理。你可以试试布林。代码没问题

如果使用基于物理的,则必须添加额外的光才能使其正常工作。

您可以保留 PBR 并使用非粗糙 material 获得玻璃反射。尽管

对视频使用 emission 而不是 diffuse
plane.geometry.firstMaterial.emission.contents = player