Jump to content

Exported file transparency issue.


hulahula
 Share

Recommended Posts

Hi guys ?

I have one question about exported .babylon file. Is it posibel chagne alpha(transparency)  of exported .babylon file? I want to make it slowly disepeat or sotmhig like that.

When i change the aplha to 0 nothing happens.

BABYLON.SceneLoader.ImportMesh("", "textures", "myObj.babylon", scene, function (newMeshes) {
  var myObj = newMeshes[0];
      myObj.alpha = 0; 
}

So I looked in the exported property whith console.log(myObj).

BABYLON.SceneLoader.ImportMesh("", "textures", "myObj.babylon", scene, function (newMeshes) {
  var myObj = newMeshes[0];
      console.log(myObj);
}

it shows me, that alpha is set NaN. And when I again change the alpha to 0 and looked in the property ... alpha was set  0 but again nothing happens.

Why is like that ?

Sorry for my bad english. ?

 

 

 

 

 

 

Link to comment
Share on other sites

Hey,

I believe you want to change the alpha on the material for the mesh, not the mesh itself.

https://doc.babylonjs.com/babylon101/materials#transparent-color-example

So your code would look something like this:

BABYLON.SceneLoader.ImportMesh("", "textures", "myObj.babylon", scene, function (newMeshes) {
  var myObj = newMeshes[0];
      if(myObj.material)
      {
          myObj.material.alpha = 0; 
      }
});

 

Link to comment
Share on other sites

You could either use the inspector: https://doc.babylonjs.com/how_to/debug_layer or console.log(myObj.material) to look at what materials are coming in with your mesh without putting a new StandardMaterial onto them.

My guess is that they are coming in with materials and you just need to set the alpha on them.

If you could upload the myObj.babylon file I could take a look.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...