Hi, i'm already read issue #41, but it hasn't enough information.
How can I change metallic or roughness factor in runtime?
For example, in sample project hellosceneform, I want to change Andy's metallic factor "0" to "1" in runtime.
Get the material from a node and set properties defined in the MaterialFactory.
see:
https://developers.google.com/ar/reference/java/com/google/ar/sceneform/rendering/Material
https://developers.google.com/ar/reference/java/com/google/ar/sceneform/rendering/MaterialFactory
Material material = node.getRenderable().getMaterial();
material.setFloat(MaterialFactory.MATERIAL_METALLIC, /* 0 or 1 for metallic */ );
material.setFloat(MaterialFactory.MATERIAL_ROUGHNESS, /* 0 to 1 */);
You save my day! thanks a lot.
@malik-at-work I have imported my models but textures are not applied properly. I think the issue is with these metallic and roughness factors. Why we can't get these values from model?
Most helpful comment
Get the material from a node and set properties defined in the MaterialFactory.
see:
https://developers.google.com/ar/reference/java/com/google/ar/sceneform/rendering/Material
https://developers.google.com/ar/reference/java/com/google/ar/sceneform/rendering/MaterialFactory
Material material = node.getRenderable().getMaterial(); material.setFloat(MaterialFactory.MATERIAL_METALLIC, /* 0 or 1 for metallic */ ); material.setFloat(MaterialFactory.MATERIAL_ROUGHNESS, /* 0 to 1 */);