-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
GLTFExporter: Support metallicRoughnessTexture #13415
GLTFExporter: Support metallicRoughnessTexture #13415
Conversation
Thanks! |
Oh just realized, ideally if occlusionMap is the same texture we shouldn’t process it again. |
Ah yeah... |
Ah, you meant that's from OcclusionRoughnessMetallic compatibility. I'll fix. |
We have to revisit this... If you only use a roughnessMap texture the exporter ignores it because roughnessMap !== metalnessMap. Also... Maybe the exporter could build the composite texture for the user? |
In glTF metallic-roughness texture, B channel is for metalness and G channel is for roughness. If you only use a roughnessMap texture and the exporter exports it as metallic-roughness texture, its B channel will be unexpectedly (for exporter user) used. So I let the exporter ignore the texture in that case. Probably we could composite and, I need to review the metallic-roughness calculation but, in the case even one of them is used perhaps we could make up by filling 0 or 1 in a certain channel? |
If we want to get into image manipulation, we could also see about converting var blob = ImageUtils.composite({
r: 1,
g: roughnessTexture,
b: metalnessTexture
}); |
I let the exporter ignore the textures in those cases because I wanted to quickly implement. I think compositing is good for users. And, as Don mentioned, doing that in helper method is nicer than doing in the exporter. It can be reusable from other modules and users (could be used for optimization?). |
👍👍👍 |
That could be nice, |
BTW tho I said it's good to users, do you think there're many models using separated |
I was trying to build my own. I was trying to add this texture (albeit is inverted) as |
I see. Yeah seems better to compose/make up not to lose info as much as possible. |
This PR adds
metallicRoughnessTexture
support toGLTFExporter
.In Three.js metalnessMap and roughnessMap can be different textures but can't be in glTF 2.0. So exporting only if they are the same texture.