Not sure if it’s the lighting, or the materials or what, but everything’s darker
Without ThinInstances
With ThinInstances
I’ve tried exporting a serialized version of the scene to help
Playgrounds
Without ThinInstances
With ThinInstances
Not sure if it’s the lighting, or the materials or what, but everything’s darker
Without ThinInstances
With ThinInstances
I’ve tried exporting a serialized version of the scene to help
Playgrounds
Without ThinInstances
With ThinInstances
Is this better now?
const mesh = nS.getMeshById('Clone of Hill_merged') as BABYLON.Mesh;
mesh.sideOrientation = 1;
Yes, thankyou ! What have I not understood?
This is the part of my code that loads meshes, I’m calling mergeMeshes on all objects set to be thinInstances, but not sure how causing winding issues.
const meshContainer = meshAssetContainer.instantiateModelsToScene();
let rootMesh = meshContainer.rootNodes[0] as Mesh;
rootMesh.rotation = babylon.Vector3.Zero();
// Babylon applies a scaling of x:1,y:1, **z:-1 ** to all meshes loaded.
// I assume that's a hack to get meshes to align with its rendering orientation
rootMesh.bakeCurrentTransformIntoVertices();
rootMesh.metadata = {};
if (shouldCreateThinInstance) {
if (!this.isInsideNullEngine()) {
const allmeshes = rootMesh.getChildMeshes() as Mesh[];
const mergedMesh = Mesh.MergeMeshes(allmeshes, true, true, undefined, false, true);
rootMesh = mergedMesh!;
rootMesh.alwaysSelectAsActiveMesh = true;
rootMesh.thinInstanceEnablePicking = true;
const instanceId = rootMesh.thinInstanceAddSelf();
rootMesh.thinInstanceSetMatrixAt(
instanceId,
babylon.Matrix.Translation(transformComponent.position.x, transformComponent.position.y, transformComponent.position.z)
);
// Todo : this would be replicated if we did this on the server...
meshComponent.thinInstanceId = instanceId;
this.assetLoader.addAssetCacheItem(thinInstanceCacheId, rootMesh);
return { createType: "thinInstance", mesh: rootMesh, thinInstanceId: instanceId, thinInstanceCacheIdForVisual: thinInstanceCacheId };
} else {
return { createType: "nullEngineResult" };
// On the server we get
// MeshHandler.ts:108 BJS - [16:22:45]: Thin Instances are not supported on this device as Instanced Array extension not supported
// Becuase it's using the null engine
}
}
return { createType: "mesh", mesh: rootMesh };
}
If I apply the sideOrientation = 1 to everything I get the ‘problem’ meshes working and the meshes that were fine misbehaving.
Checking the normals in blender implies they’re the ‘right’ way round too
I think this post should help you (but the entire thread is very informative):
Our objective is to develop a dataset and approach addressing the autonomous or assisted harvesting, loading and measuring of logs, ie cut stems and branches.