[]关于3D物件半透明漫反射率(官网上的例子)的BUG。
官网例子: http://ldc.layabox.com/doc/?nav=zh-js-4-0-7
在测试官网的半透明漫反射率的例子时,发现了BUG:
渲染时,正方体“背面”把“前面”挡住了!即各个面的渲染的顺序错乱了!
测试代码:
//初始化引擎
Laya3D.init(0, 0, true);
//适配模式
Laya.stage.scaleMode = Laya.Stage.SCALE_FULL;
Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
//添加3D场景
var scene = Laya.stage.addChild(new Laya.Scene());
//添加照相机
var camera = (scene.addChild(new Laya.Camera(0, 0.1, 100))) as Laya.Camera;
camera.transform.translate(new Laya.Vector3(0, 0, 6));
camera.clearColor = null;
//材质
var material = new Laya.StandardMaterial();
material.diffuseTexture = Laya.Texture2D.load("Assets/test.png");
material.albedo = new Laya.Vector4(1, 1, 1, 0.95);
material.renderMode = Laya.StandardMaterial.RENDERMODE_DEPTHREAD_TRANSPARENTDOUBLEFACE; //渲染模式,混合类型
//3D物件,正方体
var box = scene.addChild(new Laya.MeshSprite3D(new Laya.BoxMesh(1, 1, 1))) as Laya.MeshSprite3D;
box.transform.position = new Laya.Vector3(2.5, 1.5, 0);
box.transform.rotation = new Laya.Quaternion(-0.373,-0.070,0.16,0.91);
box.meshRender.material = material;
// //旋转(这里把注释去掉,可看旋转效果,BUG更明显:渲染时,正方体“背面”把“前面”挡住了!即各个面的渲染的顺序错乱了!)
// var vect = new Laya.Vector3(0.1,0.1,0);
// Laya.timer.loop(10,null,function(){
// box.transform.rotate(vect,true,false);
// });
在测试官网的半透明漫反射率的例子时,发现了BUG:
渲染时,正方体“背面”把“前面”挡住了!即各个面的渲染的顺序错乱了!
测试代码:
//初始化引擎
Laya3D.init(0, 0, true);
//适配模式
Laya.stage.scaleMode = Laya.Stage.SCALE_FULL;
Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
//添加3D场景
var scene = Laya.stage.addChild(new Laya.Scene());
//添加照相机
var camera = (scene.addChild(new Laya.Camera(0, 0.1, 100))) as Laya.Camera;
camera.transform.translate(new Laya.Vector3(0, 0, 6));
camera.clearColor = null;
//材质
var material = new Laya.StandardMaterial();
material.diffuseTexture = Laya.Texture2D.load("Assets/test.png");
material.albedo = new Laya.Vector4(1, 1, 1, 0.95);
material.renderMode = Laya.StandardMaterial.RENDERMODE_DEPTHREAD_TRANSPARENTDOUBLEFACE; //渲染模式,混合类型
//3D物件,正方体
var box = scene.addChild(new Laya.MeshSprite3D(new Laya.BoxMesh(1, 1, 1))) as Laya.MeshSprite3D;
box.transform.position = new Laya.Vector3(2.5, 1.5, 0);
box.transform.rotation = new Laya.Quaternion(-0.373,-0.070,0.16,0.91);
box.meshRender.material = material;
// //旋转(这里把注释去掉,可看旋转效果,BUG更明显:渲染时,正方体“背面”把“前面”挡住了!即各个面的渲染的顺序错乱了!)
// var vect = new Laya.Vector3(0.1,0.1,0);
// Laya.timer.loop(10,null,function(){
// box.transform.rotate(vect,true,false);
// });
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
qian
赞同来自: