Coder Social home page Coder Social logo

Comments (12)

ox avatar ox commented on August 14, 2024 2

So the texture it's failing on is the Ambient Occlusion png, which has 4 channels. The _convert_materials_to_preview_surface function goes in expecting to use the r component of the occulusionTexture image as the occlusion map, sees a 4 channel image, which jumps to logic trying to unpack a glossiness map.

I think if you change your ao.png to only be 3 channels, it should work

from gltf2usd.

kcoley avatar kcoley commented on August 14, 2024 2

@enzyme69 yes what @ox says is correct since the logic initially assumes that you are using an ORM texture (occlusion: r, roughness: g, metallic: b). The texture logic definitely needs refactoring. I will look into that later today to make it more robust. But in the meantime, @ox solution should work.

from gltf2usd.

kcoley avatar kcoley commented on August 14, 2024 1

@sulydeni @sulydeni I think the USD implementation in XCode/iOS always reads the alpha value even if it is not used in the glTF and is ignored in the usd file. I'll make an issue to remove the alpha channel from the texture if it is not used in glTf.

from gltf2usd.

enzyme69 avatar enzyme69 commented on August 14, 2024

Works ok on Clay-Viewer:
screen shot 2018-09-05 at 1 02 59 pm

from gltf2usd.

kcoley avatar kcoley commented on August 14, 2024

@enzyme69 do you have a sample model that repros this issue?

from gltf2usd.

enzyme69 avatar enzyme69 commented on August 14, 2024

@kcoley This is the one:
USDZ_donut_rgba_error.zip

Maybe the texture itself is problematic. Just now, I convert all the PNG into JPG and works!

from gltf2usd.

enzyme69 avatar enzyme69 commented on August 14, 2024

Also something interesting I found with RGBA and RGB, try the model below:
https://sketchfab.com/models/f8b43d7d9f914480bfc91c8a4d6fd314

For some PNG, it gives this weird flipped overlapping material on the USDZ after conversion. Again this is seems to be RGBA related. If I save PNG as RGB, it works good.

from gltf2usd.

enzyme69 avatar enzyme69 commented on August 14, 2024

It makes me wonder if we actually have "Occlusion Transparency Shader" already ...
weird_rgb

from gltf2usd.

enzyme69 avatar enzyme69 commented on August 14, 2024

@kcoley Do you mean in the Blender material node itself, I could have **Roughness - Metalness -Occlusion (**greyscale) plug into RGB node which will translate into GLTF and works with your conversion?

from gltf2usd.

enzyme69 avatar enzyme69 commented on August 14, 2024

It's this Metalness and Roughness which unfortunate...
screen shot 2018-09-07 at 7 03 32 am

from gltf2usd.

sulydeni avatar sulydeni commented on August 14, 2024

It makes me wonder if we actually have "Occlusion Transparency Shader" already ...
weird_rgb
I have a similar issue. My model does not reflect light the same way it does in gltf

from gltf2usd.

kcoley avatar kcoley commented on August 14, 2024

I recently merged a change to remove alpha channel based on alpha mode: #93

from gltf2usd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.