Damn, thanks for the help. The batch group was unfortunate, I never noticed it.
The look I’m going for is achievable with Alpha for blendMode and then playing with the emissive color. This all works and looks like in Babylon now, great!
I’m now using the MeshOpt glb version of my model and some sorting issues returned. Maybe you could take a look at it again in my project? Is there something I can do about it? It isn’t that noticable.
I don’t understand how you change the layer via code. When you access the model component of the runtime loaded .glb you can’t differentiate between the single meshInstances. When I tried to set _layer on the shell meshInstance it had no effect.
Yes, it’s a bit complicated with the legacy model component. You will have to use the Layer class methods to add and remove mesh instances (remove it from the current layer, add it to the new one):
and it did help. When the shell is rendered later some overlapping disappears but not all.
The real question is, how to automate/script this when I have like 20 glbs that are going to be loaded at runtime and all have to be set up like this.
LoadGlb.attributes.add('glbAsset', { type: 'asset', assetType: 'binary'});
LoadGlb.attributes.add('layerNames', { type: 'string', array: true});
// initialize code called once per entity
LoadGlb.prototype.initialize = function() {
var self = this;
utils.loadGlbContainerFromAsset(this.glbAsset, null, this.glbAsset.name, function (err, asset) {
/** @type {pc.Entity} */
var renderRootEntity = asset.resource.instantiateRenderEntity();
self.entity.addChild(renderRootEntity);
// Get all the render components that have been created in the hierarchy
/** @type {pc.RenderComponent[]} */
var renders = renderRootEntity.findComponents('render');
var layerIds = [];
var i;
// Get the list of layer ids
for (i = 0; i < self.layerNames.length; ++i) {
var layer = self.app.scene.layers.getLayerByName(self.layerNames[i]);
if (layer !== null) {
layerIds.push(layer.id);
}
}
for (i = 0; i < renders.length; ++i) {
renders[i].layers = layerIds;
}
// If you need a list of materials to edit, you can use:
// `asset.resource.materials` for an array of material assets
});
};
The other thing you may need to do is disable depth write on the materials that are created when loading the GLB which I believe you did in the earlier test project?
Ok, sound reasonable - but I don’t get a length at layerNames.length … looks empty
and thereby a cannot allocate the model to the World Layer
PS: yes, I remember vaguely that I gave up the last time - but I dont think I tried the layer approach then