PBR intensity isnt working

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.

1 Like

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,

2 Likes

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

1 Like

Ah ok. Of course, I couldn’t know of this function from the PG (I’m not an oracle :wink:)
Well, I’m glad if it helped you and meanwhile, have a great day :sunglasses: