Home › Forums › General Questions › Loading gLTF material
Tagged: Material
- This topic has 25 replies, 3 voices, and was last updated 6 years, 7 months ago by Yuri Kovelenov.
-
AuthorPosts
-
2017-12-22 at 8:21 am #1443nikolstrekCustomer
Hello. Please tell me, is it possible to apply an exported gLTF material to objects in the scene ? :)
2017-12-22 at 10:16 am #1447Yuri KovelenovStaff2017-12-22 at 11:20 am #1451Will WelkerCustomerIf you intend to load a material from a glTF file that you have imported after runtime, I have not been able to do that yet. But there may be better ways to make your materials available. For example, you can great a ‘library object’ which has multiple materials applied to it. In this picture, the library object is visible but you can hide it as well.
You can look at the Ring example as Yuri mentioned to see how materials are moved from object to object.2017-12-23 at 11:53 am #1457nikolstrekCustomerThanks Friends. I will look at the materials library.
But the thing that I’m trying to achieve is to apply the material created in Blender to the imported in v3d 3D model (.obj or .stl), without writing shaders.
Is it possible with the materials library or anything else? :)2017-12-23 at 12:04 pm #1459nikolstrekCustomerIt seems understood. I need to apply the material to the hidden object in Blender and then change it to a loaded obj in the scene. Like in b4w )), but how can I find the requared material in a scene ? Is there a method like scene.getMaterialByName ?
2017-12-23 at 4:38 pm #1462Yuri KovelenovStaff2017-12-24 at 8:29 am #1466nikolstrekCustomerThank you Yuri.
2017-12-24 at 10:53 am #1468nikolstrekCustomerAnd hello again ! :)
I try to apply a material from the ring to a torusvar geometry = new v3d.TorusGeometry( 10, 3, 16, 100 );
var mat = v3d.SceneUtils.getMaterialByName(v3dApp, “gold_material”);
var torus = new v3d.Mesh( geometry, mat );
v3dApp.scene.add( torus );but something goes wrong and we see a black material…
2017-12-29 at 5:50 am #1485Will WelkerCustomerIf a materiel is applied to one of your objects in Blender, then you export it with your scene, it should be available in the Material Selector block to apply it to another object.
In Puzzles, the Material selector block will have a list of all the materials in your scene. No need to do any coding unless you want to.2018-01-02 at 5:12 pm #1502nikolstrekCustomerThank you Will, but if i going to upload or create a 3d object in the scene (with .stl loader for example)
How can I apply this blender3d material for him ?2018-01-03 at 9:20 am #1510Yuri KovelenovStaff2018-01-03 at 4:31 pm #1521nikolstrekCustomerHi. Yes, this method returns object. I’ll placed a code here tomorrow morning. :)
2018-01-04 at 10:53 am #1544nikolstrekCustomerHere the console.log code, “Un” it’s undefined i guess.
Un {uuid: “A0EFAA9B-97C4-4E01-AC28-92EE7EAD1B2C”, name: “silver_material”, type: “MeshNodeMaterial”, fog: false, lights: true, …}
additionalNodeGraphs
:
{}2018-01-04 at 12:11 pm #1545Yuri KovelenovStaffThe reason for your procedural model showing in black is that it lacks UV maps. The metal materials from our configurator example are made with shader editor in Blender and require 2 UVs hand-created by a 3D artist. So I guess in your case you need either to calculate UVs for your model on the fly or use materials which do not depend on UV at all.
2018-01-04 at 3:51 pm #1546nikolstrekCustomerI was edited the “Ring” scene and delete UVs from Geometry node and set up the Normal output to the Texture, so i think this material don’t depend from UV.
-
AuthorPosts
- You must be logged in to reply to this topic.