I am having some problems trying to import the following model into WebGL using three.js:
http://tf3dm.com/3d-model/vanille-99084.html
I've converted the obj file to JSON using the converter that comes with three.js and the model works fine when using the JSON Loader. However, when trying to load the model with the textures from the .mtl file the OBJMTLOader fails.
I am using the following example and just replaced the paths with the paths to my files:
https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_obj_mtl.html
UPDATE:
I've made a bit of progress. For some reason I thought that I need to import the JSON converted OBJ rather than the obj file itself. So now that I've referenced the correct .obj file the model is imported correctly. However, the textures are still not loaded. Currently the whole model/mesh is just black.
Any help appreciated
It appears that the problem was due to the .TGA files comming with the models. Apparently, threejs can't parse TGA files. So the solution was to convert the TGA files to plain PNGs using Photoshop and then update the .mtl file to reference the PNGs rather than the TGA files.
There is a TGA Loader as well however if you don't want to do TGA to PNG conversion.
var texture = loader.load( 'textures/crate_color8.tga' );
var material = new THREE.MeshPhongMaterial( { color: 0xffffff, map: texture } );
var mesh = new THREE.Mesh( geometry, material );
From
http://threejs.org/examples/webgl_materials_texture_tga.html
Related
I am having success converting .usdz models to .dae using Xcode. However I eventually want the file formats to end up as .glb / .gltf.
I'm using blender to encode .dae into .glb, also a tool made by Khronos group here. https://github.com/KhronosGroup/COLLADA2GLTF
The problem is that the Xcode .dae output is a .dae file and a folder of .png texture files. Xcode can read this just fine and reconstitute the original .dae however blender seems to be incapable of using these texture files and same with the Khronos CLI converter. Using these tools, the .dae shows up without textures, colorless and only constituted in shape based on 3D coordinates.
Does anybody know how to use this folder of texture .png files to render color to a blender .dae?
Ultimately I want to convert .usdz to .glb / .gltf and this is the way I have found, but I'm running into this hiccup. Google search did not improve the hiccup, hence my question here.
I've been experimenting and have found another way you can possibly do the conversion to GLB outside of Blender. Basically, as you have found you convert the .usdz to .dae using Xcode - which results in a .dae file with a folder of textures (.png's). If you now zip the file and the folder together - rename the .zip file ending to .zae. Now take this .zae zip file and go to https://products.aspose.app/3d/conversion you can convert the zip file to GLB. Once you have the GLB file, test it out in Scene Viewer and you should now have the colours, textures etc. on the model. I have had a few issues on one model, namely not all the textures seem to be there, majority are but a few more detailed elements are missing. ie. I have a 3D Framed Artwork model, the black shiny frame, the brown paper backing, and the art colour background are fine but the details of the artwork are missing! Very weird. The Artwork itself is just in one texture file as a .png together with the other files for metallic, colours, etc. and it shows correctly in photoshop or viewer. Also the DAE file shows correctly in preview. Just when it's all brought together in GLB it is missing some detail. Kind of 80% sorted though. Hope this is of help!! And I also hope I have saved another fellow human being from tearing out the remainder of their hair...lol
I have a .dae model here , and I use latest version of https://github.com/KhronosGroup/COLLADA2GLTF to convert this dae file into a gltf 2.0 file.
./COLLADA2GLTF-bin -i /path/to/Archive/Bayleef_ColladaMax.DAE -o ~/test.gltf -v 2.0 --doubleSided true --preserveUnusedSemantics true
However when I view it on gltf online viewer https://gltf-viewer.donmccurdy.com/, it only displays something like tree branches.
the actual dae model:
gltfloader displays after the conversion:
babylonjs and blender loaded the glTF display just like the bad image above
I've watched some tutorials on how to add images to an object in blender. There are different ways to do it but I choose to do it as the following: with UV image editor and making a material and after that a texture for the image.
This is how it looks in blender as rendered, the front and back view:
I need this blender project to be exported to a .obj file so I can use it for an AR project in ENTiTi, but no matter what I Do, the rectangle will be empty when exported to .obj
Material and texture preview:
Can you guys please help me because I can't find a solution on google or youtube. I made a **google drive directory with the blender file, .obj file and the images:
https://drive.google.com/drive/folders/1WdspdKiK28vTmJVepi_FWb4Avs1pZOw5?usp=sharing**
Thanks a lot !
.obj format do not export the texture applied to the model, it should export the materials and texture in an .mtl file. You would need to apply the .mtl file to your .obj inside your development environment.
However, you could try to export to .fbx. I tried exporting your object to .fbx, for the reimporting to blender. Then the texture was applied correctly. ENTiTi has support for .fbx, so it should be worth a try
https://docs.blender.org/manual/en/latest/addons/io_obj.html
obj format do not export the texture applied to the model, it should export the materials and texture in an .mtl file. You would need to apply the .mtl file to your .obj inside your development environment.
I am trying to load my 3D object in android . i tried mat-d's tutorial and it worked. now I am trying to load other object (example a cake with color) that has no image textures. the problem is the object will load but the color will not
You mentioned in your question that you don't have an image texture which i am guessing as the mtl file. In min3d you need to put in both the obj file as well as the mtl file in order to load the object correctly. So either you will have to create an mtl file or download another sample which has an mtl file.
I have followed the example from mat-d's tutorial and was able to load obj files correctly. Also make sure that you put the jpeg file in the drawable folder and set the path in mtl file correctly.
Hi
I have added materials (colors) to a 3D model. How to export to an .obj file, along with a .tga file as a UV unwrapped file ? In other words, I want the .tga file to contain all materials (colors) that I added, so that an image file taken as reference. Thanks.
First unwrap your model (UV textures & mapping) then bake the textures to an image file (render baking).
http://wiki.blender.org/index.php/Doc:Manual/Render/Bake