We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Loading gLTF material

Home Forums General Questions Loading gLTF material

Tagged: 

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • #1443
    nikolstrek
    Customer

    Hello. Please tell me, is it possible to apply an exported gLTF material to objects in the scene ? :)

    #1447

    Hello and welcome!

    Yes you can assign a material to an object with Puzzles – check out the ring configurator demo, for example.

    Chief 3D Verger | LinkedIn | Twitter

    #1451
    Will Welker
    Customer

    If 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.
    Material Library
    You can look at the Ring example as Yuri mentioned to see how materials are moved from object to object.

    #1457
    nikolstrek
    Customer

    Thanks 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? :)

    #1459
    nikolstrek
    Customer

    It 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 ?

    #1462

    here you go:

    v3d.SceneUtils.getMaterialByName(v3dApp, name)

    Chief 3D Verger | LinkedIn | Twitter

    #1466
    nikolstrek
    Customer

    Thank you Yuri.

    #1468
    nikolstrek
    Customer

    And hello again ! :)
    I try to apply a material from the ring to a torus

    var 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…

    #1485
    Will Welker
    Customer

    If 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.

    #1502
    nikolstrek
    Customer

    Thank 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 ? :scratch:

    #1510

    Hi,
    can you check if getMaterialByName() returns an actual material? If it is undefined it can cause that black color.

    Chief 3D Verger | LinkedIn | Twitter

    #1521
    nikolstrek
    Customer

    Hi. Yes, this method returns object. I’ll placed a code here tomorrow morning. :)

    #1544
    nikolstrek
    Customer

    Here 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
    :
    {}

    #1545

    The 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.

    Chief 3D Verger | LinkedIn | Twitter

    #1546
    nikolstrek
    Customer

    I 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.

Viewing 15 posts - 1 through 15 (of 26 total)
  • You must be logged in to reply to this topic.