KhronosGroup / glTF-Blender-Exporter

Moved to https://github.com/KhronosGroup/glTF-Blender-IO.
Apache License 2.0
835 stars 189 forks source link

Blender doesn't export textures #46

Closed Reon90 closed 7 years ago

Reon90 commented 7 years ago

I opened https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/sourceModels/DamagedHelmet in Blender 2.78c then I tried to export model. I turned on all export settings.

Actual result: There is no textures field in gltf Expected result: There is textures field in gltf

UX3D-nopper commented 7 years ago

The Blender file is outdated and uses a very old glTF 2.0 node group. Because of this, your exporter cannot export correctly.

Please use the latest node group and reassing the materials and textures. How to do this is documented here: https://github.com/KhronosGroup/glTF-Blender-Exporter/blob/master/docs/user.md

Reon90 commented 7 years ago

@UX3D-nopper thank you. Maybe you can help me with one question? How can I export vertex and fragment shaders using glTF-Blender-Exporter?

UX3D-nopper commented 7 years ago

No, that is not - yet - possible, as the spec is not updated to glTF 2.0 yet.

emackey commented 7 years ago

The Blender file is outdated and uses a very old glTF 2.0 node group.

Is there any versioning on the node group? How often can we expect breaking changes, such that older copies can't be re-exported with newer software? What's the best way to upgrade a blend file that uses an older group?

UX3D-nopper commented 7 years ago

At the moment, the Blender exporter is in the alpha phase, meaning minimal changes can still happen and no version exists. Next week we will probably start the beta phase and as soon we are final, we do have our first version of the exporter. This first version - and also the node group - will then be tagged and can be used for production. Of course, the exporter will permanently be developed, but these breaks should not happen again. Also, it is always possible to fallback to this version. For the future, if an Eevee node is used, probably a hard break could happen again. But in this case, we will provide a script which does the conversion.

I am sorry for this but we thought, the community knows, that the Blender exporter is not final yet. Yes, the exporter is feature complete, but not regarding testing and bug fixing.

Did you append or link the glTF2 Blender file?

emackey commented 7 years ago

For the damaged helmet blend file, if I recall I loaded the gltf2.blend file directly, and then used the glTF importer to bring the geometry in, and connect it to the existing node group. Should be an easy fix though, since there's only one material.

UX3D-nopper commented 7 years ago

If u get into trouble, delete the current node groups, save and close Blender. Open the file again and import the new node group.

DJviolin commented 7 years ago

I closely followed the tutorial that you linked here, but the texture not appearing on the monkey head. What I did wrong?

gltf-texture-test

I'm attaching the test model:

model.zip

Here is a texture I try to apply:

texture.zip

UX3D-nopper commented 7 years ago

The Monkey/Suzanne has no UV-Textures bye default. So no texture is visible. YOu would need to unwrap the mesh and add the texture coordinates: https://wiki.blender.org/index.php/Doc:2.4/Manual/Textures/Mapping/UV/Unwrapping

You can also try to use Suzanne, which is included in the scenes folder: https://github.com/KhronosGroup/glTF-Blender-Exporter/blob/master/scenes/02_suzanne.blend We already added texture coordinates there.

DJviolin commented 7 years ago

Thank You! I have a model where if I exporting to gltf2 format with Blender, all textures missing. If I converting with colada2gltf tool, then there are textures, but they dimming/vibrating. That's why I found this tutorial, although this model has perfectly textured, I have to unwrap and replace all the textures again on the faces, if I want to convert to gltf2 with Blender? Seems like a very verbose task.

UX3D-nopper commented 7 years ago

glTF 2.0 introduced PBR materials. There are two workflows, on how to export the properties of them. I always recommend the PBR guide from allegorithmic, as glTF 2.0 does not make it differently: https://www.allegorithmic.com/pbr-guide

The problem is, that in a normal use case, the current available Blender materials cannot be exactly matched to the glTF PBR matrials. That is the reason, why this glTF 2.0 node group exists: It allows to export the materials almost 1:1.

As soon as Eevee is available for Blender, this problem is gone, as materials almost match each other.

DJviolin commented 7 years ago

Thank You again the info. This means we don't have to re-texture the entire model?

Is there any plan for an updated guide for the Eevee renderer?

Right now, for the quickest result, probably I should use collada2gltf?

aalavandhaann commented 6 years ago

Hello,

Thanks for this wonderful plugin. Can someone tell me how to export the baked textures from my Blender to GLTF? Do you have a gltf node to do that or should I use the standard blender image texture node to export the baked textures?

Regards,

0K

donmccurdy commented 6 years ago

@aalavandhaann have you seen the Cycles nodes documented here? https://github.com/KhronosGroup/glTF-Blender-Exporter/blob/master/docs/user.md#gltf-20-materials Those nodes may be used with Blender's standard "Image Texture" nodes.

aalavandhaann commented 6 years ago

@donmccurdy ,

Sincerely it was my bad all the while. I indeed used the nodes provided by you guys and exported the GLTF. Works without flaws. But I was lazy enough to not let others know that my problem has been resolved. Sorry for this.

However I am still struggling with exporting Actions, and Markers from Blender for animation. Nevertheless, I am happy about the whole format of GLTF and your plugin to export GLTF from Blender. Finally, the web format has been finalized. So I should not be bothering you guys with anymore feature requests, rather let you creators prioritize what is the need of hour.

Once again, thank you for this wonderful blender plugin. Meanwhile I am thinking if there is a way to contribute apart from using the Blender plugin (testing it). As of now I was trying to export Cloth animation from Blender, and I wrote a short script to convert every frame of the mesh to a shapekey with the modified vertex positions. Hmmm, you know what? As of now let this page discuss only about issues to the Textures, I will meanwhile post the whole exporting of Blender physics animations in a separate thread.

Regards,

0K

donmccurdy commented 6 years ago

Thanks for the update! Exporting actions is still an open issue that we plan to address (https://github.com/KhronosGroup/glTF-Blender-Exporter/issues/112), I'm not sure about Markers — feel free to open an issue on that. It may not be possible to represent them in glTF at this time, unless they are used to denote separate animation clips?

Separate issue may be needed for cloth simulation as well, as you said... I've done tests baking keyframes from animation_nodes for translation/rotation/scale of nodes, but nothing with morph targets as keyframes so far.

aalavandhaann commented 6 years ago

@donmccurdy ,

Does anyone have an idea about texture repeat/sampling? Do we have a gltf-node to handle texture repeat? Currently I am trying to do this and this fails without repeating the texture. Is there something I am missing here?

selection_013

Regards,

0K

donmccurdy commented 6 years ago

@aalavandhaann the glTF format does not currently support texture repeat, and this exporter is not able to bake those transforms into UVs for you. We're working on adding that feature to glTF (see this issue: https://github.com/KhronosGroup/glTF/pull/1015) and once that's done the Blender Exporter should support it as well.

jamesdeantv commented 6 years ago

@donmccurdy Any progress on supporting texture repeat in the Blender Exporter?

donmccurdy commented 6 years ago

See https://github.com/KhronosGroup/glTF-Blender-Exporter/issues/226 — I don't have a time estimate, but PRs would be welcome.

Lucocito commented 6 years ago

Hi, I'm trying to export a very simple model with textures. The textures are lost when exporting to glTF. The same file exports correctly to collada. What am I doing wrong?

personaje.blend.zip seven Many thanks in advance for your help!

Lucocito commented 6 years ago

Looks like what I was doing wrong was not to use the PBR materials. After reading the doc I managed to link the ImageTexture as the "Color" in for the glTFMetallicRoughness node, and then the "Shader" out to the "Surface" in of the Material Output node. I have exported it this way and works!

artistneel commented 6 years ago

how to export environment texture

donmccurdy commented 6 years ago

Environment textures cannot be exported to the glTF format currently, you’ll need to load it separately.