Babylonjs加载两个图像在彼此的顶部与第二个图像是透明的
Babylonjs load two images on top of eachother with the second image being transparent
我正在使用babylonjs加载两个图像。一个是标准的jpg图像,另一个是带有透明背景的png图像。当我加载这两个图像时,图像会在彼此的顶部加载,但jpg图像不会通过应该透明的区域显示出来。有谁知道我是怎么做到的吗?
var createScene = function() {
var scene = new BABYLON.Scene(engine);
//Create a light
var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(-60, 60, 80), scene);
//Create an Arc Rotate Camera - aimed negative z this time
var camera = new BABYLON.ArcRotateCamera("Camera", Math.PI / 2, 1.0, 210, BABYLON.Vector3.Zero(), scene);
camera.attachControl(canvas, true);
//Creation of a repeated textured material
var materialPlane = new BABYLON.StandardMaterial("texturePlane", scene);
materialPlane.diffuseTexture = new BABYLON.Texture("images/art.jpg", scene);
//materialPlane.emissiveTexture = new BABYLON.Texture('images/scodix1.png', scene);
//materialPlane.useAlphaFromDiffuseTexture
materialPlane.specularColor = new BABYLON.Color3(0, 0, 0);
materialPlane.backFaceCulling = false; //Allways show the front and the back of an element
var spotPlain = new BABYLON.StandardMaterial("texture", scene, true);
spotPlain.emissiveTexture = new BABYLON.Texture("images/scodix1.png", scene);
spotPlain.anisotropicFilteringLevel = 50;
//materialPlane.emissiveTexture = new BABYLON.Texture('images/transparent.png', scene);
//materialPlane.useAlphaFromDiffuseTexture
spotPlain.specularColor = new BABYLON.Color3(0, 0, 0);
spotPlain.backFaceCulling = false; //Allways show the front and the back of an element
//Creation of a plane
//var plane = BABYLON.Mesh.CreatePlane("plane", 120, scene);
var plane = BABYLON.MeshBuilder.CreatePlane("plane", {
width: 261,
height: 153
}, scene);
plane.rotation.x = Math.PI / 2;
plane.material = materialPlane;
plane.material = spotPlain;
return scene;
};
var scene = createScene();
engine.runRenderLoop(function() {
scene.render();
});
您正在覆盖这里的材料:飞机。material = materialPlane;飞机。
我建议创建两个平面
相关文章:
- 背景图像顶部的滚动图像不移动
- 如何在引导程序中将输入文本框嵌入到图像的顶部
- 使用paperjs在图像顶部绘制
- HTML5 中图像顶部的超链接文本
- 引导进度条,顶部附有图像
- 如何在 jQuery 中将可点击的图像定位到浏览器顶部
- 如何停止幻灯片放映隐藏文本和图像跳到顶部,而下一张幻灯片进来
- 图像旋转背景 js 跳转到页面顶部
- HTML5 画布 - 我的线条/弧线没有出现在图像顶部
- 当圆形图像在圆轮中发生变化时,如何在顶部显示标签
- 在图像顶部显示文本
- 图像映射顶部的文本
- 使用 JavaScript 在鼠标悬停时在内容顶部查看放大的图像
- 在HTML和Javascript中的图像顶部“绘制”
- 获取图像以覆盖在表格顶部
- 在图像顶部添加数字
- 用户在图像顶部绘制形状
- 如何在图像顶部放置标记,标记的位置相对于图像给出
- 在背景图像顶部定位按钮
- 将元素从图像顶部定位 50%