Create a texture from png file and pass to material definition - google-filament

I have a material package that has a parameter named texture of type sampler2D.
I'm stbi_image to decode a png file I would like to know how do I call setparameter on that material to pass this texture I decoded on file ?

Related

gltf viewer does not display full dae model after COLLADA2GLTF conversion

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

Blender adding image / texture on object does not show up in .obj document

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.

min3d loading objects with just colors no texture imgs. color wont load

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.

WebGL importing models using the OBJMTLoader in three.js fails

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

Exporting materials to seperate .tga UV map file in blender

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

Resources