Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glTF model appears with black shades #5835

Closed
ghost opened this issue Sep 18, 2017 · 21 comments
Closed

glTF model appears with black shades #5835

ghost opened this issue Sep 18, 2017 · 21 comments

Comments

@ghost
Copy link

ghost commented Sep 18, 2017

I have glTF model of the mesh. I have used obj2gltf for conversion. After I loaded it to Cesium, it showed in black colors.

I have tried to open it in different glTF viewers, it showed in correct colors.

I assume there is some bug in cesium.

@lilleyse
Copy link
Contributor

Could you send over the model you're testing?

@ghost
Copy link
Author

ghost commented Sep 18, 2017 via email

@lilleyse
Copy link
Contributor

Thanks for sending the model over. The problem is we are not generating PBR shaders correctly for models that don't have normals. I opened an issue here: #5838.

In the meantime you can use the --materialsCommon flag with obj2gltf and this should look correct in Cesium.

@lilleyse
Copy link
Contributor

I also opened up this PR in obj2gltf to prevent transparency of 0, which is another problem I noticed with the glTF: CesiumGS/obj2gltf#107

@ghost
Copy link
Author

ghost commented Sep 21, 2017 via email

@lilleyse
Copy link
Contributor

Hm.. would you mind also sending the obj model over?

@ghost
Copy link
Author

ghost commented Sep 21, 2017 via email

@lilleyse
Copy link
Contributor

Ok I realized what the problem was in obj2gltf and opened a PR. Make sure to still use the --materialsCommon flag.

CesiumGS/obj2gltf#108.

Let me know how it goes.

@ghost
Copy link
Author

ghost commented Sep 21, 2017 via email

@lilleyse
Copy link
Contributor

Until the PR is merged make sure you're on the constant-lighting branch. It works for me with this command:

node bin/obj2gltf.js -i test/mocsa4/Mocsa4_simplified_3d_mesh.obj -o test/mocsa/output/Mocsa4_simplified_3d_mesh.gltf --materialsCommon

model

@lilleyse
Copy link
Contributor

It was just merged so being on master is fine too now.

@ghost
Copy link
Author

ghost commented Sep 21, 2017 via email

@ghost
Copy link
Author

ghost commented Sep 21, 2017 via email

@lilleyse
Copy link
Contributor

@michaelknave You may need to use the github interface to attach an image.

@ghost
Copy link
Author

ghost commented Sep 21, 2017

2017-09-21_1754

@lilleyse
Copy link
Contributor

Try running npm run build.

@ghost
Copy link
Author

ghost commented Sep 21, 2017 via email

@ghost
Copy link
Author

ghost commented Sep 21, 2017 via email

@lilleyse
Copy link
Contributor

I'm not sure what else could be the problem. Make sure you are running the latest obj2gltf. This is the Sandcastle code I'm using:

var viewer = new Cesium.Viewer('cesiumContainer');

function createModel(url, height) {
    viewer.entities.removeAll();

    var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);
    var entity = viewer.entities.add({
        name : url,
        position : position,
        model : {
            uri : url
        }
    });
    viewer.trackedEntity = entity;
}

createModel('../../SampleData/test/mocsa4/Mocsa4_simplified_3d_mesh.gltf', 5000.0);

@ghost
Copy link
Author

ghost commented Sep 21, 2017 via email

@lilleyse
Copy link
Contributor

Good to hear!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants