-
Hello, I'm trying to change the following material property of a .glTF; "metalic" and "roughness". Here is my attempt code:
Executing that method above will crash my application Please, what I'm doing wrong here? Because the logs it generate are very difficult for me to decrypt and debug it since I have no real experience with 3D nor filament itself.
Above is the method i should be using on renderableManager instance for applying a new material at run time, however what this "primitiveIndex" parameter means? or where should i get that? is there any other better ways to create Materials instances? or to apply materials at run time on .gltf ? Also sometime this line can also cause a crash Any code would be really helpful please. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
It crashes because you are creating an empty material. A An entity with a renderable component (from In the particular case of glTF instead of creating new materials you could simply get the existing materials and modify their properties. |
Beta Was this translation helpful? Give feedback.
It crashes because you are creating an empty material. A
Material
needs to be built by loading a file compiled withmatc
(you can see examples of materials in our sample apps).An entity with a renderable component (from
RenderManager
) is made of several "primitives" (think submeshes with different materials, for instance a sword would have a primitive for the blade made of metal, and another primitive for the hilt made of leather). The primitive index is simply which primitive you want to modify.In the particular case of glTF instead of creating new materials you could simply get the existing materials and modify their properties.