engine
engine copied to clipboard
camera tranparent background not behavior correctly in mobile
Describe the bug When set camera's background color to 'new Vector(0, 0, 0, 0)', it behavior normally in both PC and mobile. But when set camra's background color to 'new Vector(1, 1, 1, 0)', it behavior normally in PC (transparent background), while still have white background in mobile.
(have tried Mi10 utlra, IPhone 12 Simulator, and IPhone 11)
@colorhook iOS 8.1 可能会有一些 JS 语法支持性的报错,可以查看一下一些报错,在构建层打入一些 polyfill,目前我们也没有做 ios 8.1 的测试了,普遍都往 iOS 10 以上测试。iOS 8 会做降级。
是的,polyfill 在应用层做更合适。 @yinxing-ws 可以再给一下详细的错误信息
@colorhook 没有报错信息, 下面这个是个简单的demo, 在手机上仍显示白色背景(小米10ultra + 手淘/浏览器, iphone12pro模拟器都会有)。 如果把camera的backgroundColor设成new Vector(0, 0, 0, 0), 则为透明背景 表现正常。
web端都表现正常。
@yinxing-ws demo 直接发我吧,我 check 一下
@husong-sudo 我写了一个简单的demo,地址是https://github.com/yinxing-ws/demo , 用create-react-app脚手架,只改了src/App.js里的代码。 我手机机型是小米10ultra, iphone 12模拟器也看过, 都会出现这个问题, web上没问题。
engine>=0.3.7,pc设置透明背景也不行,变成黑色
跟上面这位大哥一样的例子
@yinxing-ws @L-Chris 目前在移动端必须要(0, 0, 0, 0) 才能实现完全透明。
const canvas = document.getElementById("canvas");
const gl = canvas.getContext("webgl");
gl.clearColor(1.0, 0.0, 0.0, 0.0);
gl.clear(gl.COLOR_BUFFER_BIT);
用 WebGL 的方法也是一样的。这个我们还需要深入了解一下是否是平台 GPU 差异导致的问题。
engine>=0.3.7,pc设置透明背景也不行,变成黑色
跟上面这位大哥一样的例子
When the version is greater than or equal to 0.3.7, transparent blending needs to be turned on by:
const engine = new WebGLEngine("oasis-demo", { alpha: true });