Coder Social home page Coder Social logo

takahirox / gltf-blender-io-materials-variants Goto Github PK

View Code? Open in Web Editor NEW
72.0 8.0 8.0 47 KB

Blender3D addon for glTF KHR_materials_variants extension

License: Apache License 2.0

Python 100.00%
blender gltf blender3d b3d extensions graphics 3d cg python addon

gltf-blender-io-materials-variants's Introduction

glTF-Blender-IO-materials-variants

glTF-Blender-IO-materials-variants is a Blender addon for glTF KHR_materials_variants extension on top of glTF-Blender-IO addon.

Compatible Blender version

>= 3.1

How to install

Ensure the glTF-Blender-IO addon is installed and enabled

Ensure the glTF-Blender-IO addon is installed and enabled in your Blender because the glTF-Blender-IO-materials_variants addon works on top of it. You can check it by Edit -> Preferences -> Add-ons -> "glTF 2.0" in the search bar. The glTF-Blender-IO addon should be listed as Import-Export: glTF 2.0 format. It should be installed and enabled by default.

Ensure glTF-Blender-IO is installed and enabled

Download the zip archived source code

Download the zip archived source code from the Releases.

Download the zip archived source code from the Releases

Install glTF-Blender-IO-materials-variants addon

Install the glTF-Blender-IO-materials-variants addon to your Blender via Edit -> Preferences -> Add-ons -> Install -> Select the downloaded file

Edit -> Preferences

Add-ons -> Install

Select the downloaded file

Ensure the addon is installed and enabled.

Ensure the addon is installed and enabled. You can easily find the addon by inputting "KHR_materials_variants" in the search bar.

Ensure the addon is enabled

Features

The addon enables to import, export, and edit support the glTF KHR_materials_variants extension in Blender.

How to use

The addon adds the "Materials Variants" panel to the Object property. You can add, remove, and edit the variants (alternate) materials for an mesh object in the panel. And the addon imports the KHR_materials_variants extension to the panel.

Materials Variants panel

The addon also imports the KHR_materials_variants extension materials into the material slots of a mesh object.

Import to the material slots

The addon exports (not only an active material but also) the variants materials, and exports the variants materials configurations as KHR_materials_variants extension to the exported glTF.

Export as KHR_materials_variants extension

Limitations

Currently the addon allows to set variant materials per a mesh object but it should allow it per a vertex_group of a mesh object similar to that the Blender allows to assign a material per a vertex_group of a mesh object #4

gltf-blender-io-materials-variants's People

Contributors

rassie avatar takahirox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gltf-blender-io-materials-variants's Issues

Question about the addon.

I'm curious how one would use this addon's feature in python scripting. ie add a variant programatically.

not working in blender 3.2

I have tried 0.0.2 and 0.0.3. Both work fine in blender 3.1

image

In blender 3.2 they changed the gltf exporter again so the add-on doesn't add material variants anymore:

image
Blender3.2.zip

Not working with model-viewer

I added 4 variants to the Blender default cube. When exporting a gltf there was no root level extensions block including the variant names. The extensions block at mesh level used names. I manually added the root level names block and change the mesh level extensions block to use indices not names and everything worked fine. In the end I switched to using the model-viewer editor to add variants. I reported this issue first on Twitter.

Extention not in Root/Extentions

Hi,
first of all thanks for that add-on, it will allow our users to easily create different types of materials and later choose them in our online editor.

The first try was successful, simple cube and sphere:
image

But when I use a different model there is no "extensions" object on the root level, the meshes have it though:
image
Material_Variants.zip

The remove "x" button is big

The remove "x" button is big. I think it would be good if it's smaller and placed at the right. But I'm still not familiar with Blender panel layout so I'm happy if Blender addon masters help me.

image

Only original variant displays

Trying to get this to work, so close.
I’ve exported gtlf file from blender with the variant add-on and loaded into three.js, using the example from three.js to select a material variant from gui.

The model loads fine with the original variant material. The gui appears with variants listed.

But changing the material on gui doesn’t change material.
I’m exporting as gtlf-embedded from blender.

My variants load and display on this viewer:
https://modelviewer.dev/

So I think my problem is actually with the example and parser, not the exporter.

Material variants do not work / gltf code not the same as shown in Documentation / Gestaltor crahes at import

Blend
Blend2

I tried to create a Multi Material gltf and to verifiy i imported several test files to Gestaltor.
Gestaltor crashes aswell as Babylon.js

Babylon gives this Error:
/extensions/KHR_materials_variants/variants/Red: Failed to find index (Red)

i then opened the gltf file with notepad and compared the code to the official documentation of the KHR_materials_variants extension aswell as the picture you provide in your documentation.

Notice how the Code under "extensions" is different ("extensionUsed") and there is noting declared under the KHR_materials_variants extension.
Notepad01

Notepad02

is this correct to put the names instead the numbers here behind "variants"

Notepad03

I tried to alter the file manually but had no luck.

other gltf viewers that dont support the extension can open the model.

please fix since i just cant get this to work.

regards.

Material Variants not working

Hey i really appreciate your work, but i have two problems:

  1. none of the declared materials from the object properties got assigned to a material slot
  2. no variant is visible after export

Enable to set variant material per vertex_group

Currently the addon allows to set variant materials per a mesh object. But Blender allows to assign a material per vertex_group of a mesh (and the vertex_groups of a mesh are exported as primitives of mesh and different materials can be assigned for each primitive can in glTF). Similarly the addon should be able to allow to set variant materials per vertex_group of a mesh.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.