Comments (4)
Yes they all have the same material. I will add a clone function I think, this is the best way here
from babylon.js.
For now, here is a workaround, by assigning a new material to each clone:
BABYLON.SceneLoader.ImportMesh("Suzanne", "3Dmodels/" + name + "/", name + ".babylon", scene, function (newMeshes, particleSystems, skeletons) {
var suzanne = newMeshes[0];
for (var i = 0; i < 10; i++) {
var clone = suzanne.clone("clone"+i)
//new material for each clone
var newMat = new BABYLON.StandardMaterial("mat" + i, scene);
clone.material = newMat;
clone.material.emissiveColor = new BABYLON.Color3(Math.random(), Math.random(), Math.random());
}
});
from babylon.js.
Thanks for the workaround! However, my simple example didn't highlight the importance of the clone method.
I am importing a complicated mesh with a material that uses a texture that has been built to look like a real life object with all the appropriate colors and uv mappings. Creating a new material from scratch won't work as I'd have to copy every property from the original material.
from babylon.js.
For sure then ;)
Thx to @deltakosh, Clone() function is nearly ready, it will be available in the very next version.
from babylon.js.
Related Issues (20)
- UI colors for NGE leaking to NME
- Possible to drop a category to NME/NGE
- GLTFFileLoader does not support EXT_mesh_features extension HOT 1
- Collection node throws error that prevents build if connected mesh not defined in NGE
- CreateScreenshot and friends don't fire unless you use runRenderLoop() HOT 3
- Error when trying to load it from jsDelivr HOT 3
- Add labels to WebGPU objects (GPUBuffer) - Allow users to override labels HOT 1
- Reverse winding order flag for MeshBlock in NGE
- KHR_materials_transmission: missing opaqueSceneTexture after mesh deletion.
- Exploration of extracting scene texture data to use with node geometry
- NGE saving cached mesh data to json HOT 3
- Description of Vector3.TransformNormal & Vector3.TransformNormalToRef & Vector3.TransformNormalFromFloatsToRef is wrong. HOT 1
- Scene.getMeshesByTags doesn't use argument predicate as filter HOT 2
- Add "Remove" buttons for data on Texture and Mesh in NGE
- Two scenes were created by babylon. In the first scene, add a ball and add a gizmoManager. In the second scene, add a cube and add a gizmoManager. You will find the gizmo of the two scenes, They can only be rendered in the first scene HOT 5
- Investigate GUI rounding
- Flipped faces in glTF export HOT 3
- Shader code is not compatible in webgpu mode HOT 1
- Allow instantiateOnFaces block of node geometry to infer UV coordinates
- TextureBlock without serialized data connected to setColor fails to parse in node geometry
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babylon.js.