使用视频纹理作为不透明度纹理



如何在巴比伦JS中使用视频(mp4(作为alpha地图?

在三中.js将视频应用为纹理就像将视频纹理分配给 alphaMap(而不是漫反射贴图(一样简单。

这是三个.js - 演示的预期结果。

我试图在巴比伦JS中做同样的事情,但无济于事。这是我到目前为止拥有的babylonJs演示

var mat = new BABYLON.StandardMaterial("mat", scene);
var videoTexture = new BABYLON.VideoTexture("video", ["textures/babylonjs.mp4", "textures/babylonjs.webm"], scene, true, true);
mat.opacityTexture = videoTexture;

欢迎任何想法。谢谢

您可以使用

videoTexture.getAlphaFromRGB = true;来组合使用alpha的所有三个通道。默认情况下,它仅使用红色通道,该通道在源视频中没有足够的差异来显示。

完整示例:

var mat = new BABYLON.StandardMaterial("mat", scene);
var videoTexture = new BABYLON.VideoTexture("video", ["textures/babylonjs.mp4", "textures/babylonjs.webm"], scene, true, true);
videoTexture.getAlphaFromRGB = true;
mat.opacityTexture = videoTexture;

最新更新