Hi everyone
I have added environment texture and trying reduce pbr intensity to reduce brightness on mesh. And trying to set position but its not working. Any suggestions please.
Iâm not an expert of glb files import but may I just ask where you got this âmaterialedMeshesâ from?
By any means, your call on the âmodelâ will not work because âmodelâ is not your mesh (nor a root or a transformNode) and is also called outside the load function.
When you import from blender, all your meshes are placed inside a ârootâ parent that is also transformed to match the BJS left-handed system. A good practice is to first unparent from this node and remove it. Eventually parenting your meshes to new.
As I said, I know nothing about this âmaterialedMeshesâ import in BJS but next, once your meshes will in truth be imported and with their material assigned, I can answer the second part of your question:
To reduce environment intensity on a PBR material, the way I use is to lower the level of the environment (rather than intensity). It will keep with the difference between the most white and most black point. It will just lower the effect of the environment on the material (similar to using levels in PSD)
EDIT: Hereâs for a way I know about.
Hereâs a quick version showing how you can unparent your meshes from the generated ârootâ node after the import from Blender and also dispose of the transformNodes and the root (to be used in case they are useless, of course).
Also, didnât correct in the first PG, âcamera.getByIDâ (on line 6) is deprecated (not just for camera, but also for meshes, materials, etc). Use âbyNameâ or âuniqueIDâ instead (or in case of a i.e. a material, use âidâ instead). Hope this helps,
Thanks for your response @mawa
I have fucntion where on click i apply texture to meshes which im importimg from github so im using âmaterialedMeshesâ
Here is the source code for reference.
addModels = () => {
this.materialedMeshes = ;
BABYLON.SceneLoader.ImportMeshAsync(ââ,
âhttps://raw.githubusercontent.com/pavankulkarni11/3D_Meshes/main/â,
âwall_frame.glbâ, this.scene).then((frame) => {
this.materialedMeshes.push(frame.meshes[1]); // push meshes that you want to give material (+texture) to array
});
};
handleClick() {
if (this.mat) { // if former material exist
this.mat.dispose(); // free old material resources
}
this.mat = new BABYLON.StandardMaterial(âmatâ, this.scene);
this.mat.diffuseTexture = new BABYLON.Texture(âhttps://devprojectupload.s3.ap-south-1.amazonaws.com/32490.pngâ, this.scene);
this.materialedMeshes.forEach(mesh => mesh.material = this.mat);
}
And why i was assigning imported model to variable means to apply PBR material to it.
And effect of the environment on the material is what i was trying to achive. You explained it nicely.
Thanks again
Ah ok. Of course, I couldnât know of this function from the PG (Iâm not an oracle )
Well, Iâm glad if it helped you and meanwhile, have a great day