创建 默认cube,材质,贴图,use instancing
一切ok,drawcall = 1
创建effect,properties一个 idx 偏移v_uv,用来显示不同牌
结果:失败。drawcall > 1
问题:即使不设置偏移,单纯使用
let e = this.box.getComponent(ModelComponent)!.materials[0]
这个方法也会增加drawcall … 这是为啥?
是我的方式有问题吗?高手都是如何解决的?感谢指点!
创建 默认cube,材质,贴图,use instancing
一切ok,drawcall = 1
创建effect,properties一个 idx 偏移v_uv,用来显示不同牌
结果:失败。drawcall > 1
问题:即使不设置偏移,单纯使用
let e = this.box.getComponent(ModelComponent)!.materials[0]
这个方法也会增加drawcall … 这是为啥?
是我的方式有问题吗?高手都是如何解决的?感谢指点!
直接告诉老板,棋牌用户才不会在乎游戏流畅不流畅呢。你给他们提现就行
如果是我,我会尝试把所有牌的贴图打成图集,创建一个material,不同的牌调整material的uv偏移,实时光照肯定得关闭,自定义一个逐顶点的半兰伯特光照模型给所有material
同个材质修改v_uv了,就无法合批,自然drawcall+1
如果要合批,那就要用合批参数,自己写shader
在vs
#if USE_INSTANCING // 合批时可以更改的参数
in vec4 instanced_uv;
#endif
然后用setInstancedAttribute来更新
var model = this.getComponent(MeshRenderer);
this.tmpInstancedValue[0] = x;
this.tmpInstancedValue[1] = y;
this.tmpInstancedValue[2] = z;
this.tmpInstancedValue[3] = w;
model.setInstancedAttribute(propertyName, this.tmpInstancedValue);
可以查一下文档里有
感谢回答!终于弄明白了,重点是要在vs中操作
哇,你也成功拉? 我当时研究了好久, 能节省一些别人的时间,我也很高兴 
高端操作,我们的是直接搞的,最多就是打打图集,因为是app 感觉也没啥卡顿。先mark一下说不定以后能用上。

该主题在最后一个回复创建后14天后自动关闭。不再允许新的回复。