Jump to content

why don't work alpha channel and Transparency when loding obj file


lingkernyurk.
 Share

Recommended Posts

I am a beginer of babylon.js.

I was going to load obj file using babylon.objfileloader, but did't work alpha channel and transparency in loading obj.file.

The code I worked is follow

var loader = new BABYLON.AssetsManager(scene);
BABYLON.OBJFileLoader.OPTIMIZE_WITH_UV = true;
var mesh;
mesh = loader.addMeshTask("bane", "", "Assets/Chicken Coop/", id + ".obj");

obj file works well in assimpView, but don't work in babylon.js

image.png.1e1bd728e7570595bd0d937c919315f3.png

Here is result by babylon.js

image.png.b2c7bfcb5636cc894810fc67862f8fb1.png

 

I believe you to help me.

best regards.

Edited by lingkernyurk.
lingkernyuri
Link to comment
Share on other sites

Hi javalang

Thanks your reply.

I did work as you said, but it don't work well.

Send my code.

           mesh = loader.addMeshTask("bane", "", "Assets/"+ type +"/", id + ".obj");
            mesh.onSuccess = function (task) {
                allMesh = task.loadedMeshes;
            for(i=0; i<task.loadedMeshes.length;i++)
                {
                           allMesh.material.diffuseTexture.hasAlpha = true;
                }

I believe you can help me.!

 Waiting for your reply.
 

 

 

Link to comment
Share on other sites

I wasn't able to load your file into the sandbox, I think there is some mismatch in the obj-file.

What I did: importing into blender and exporting it to test.babylon with "Texture location"-option is set to "inline" for enbedding all textures. No special code required to render the file.

Hint for loading objects in general: first make sure the import into http://sandbox.babylonjs.com/ is correct, after then your programmatically import will also be fine :)

in the attachment you can find my converted .babylon file.

Hope this helps.

screen.jpg

test.babylon

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...