sceneform-android-sdk icon indicating copy to clipboard operation
sceneform-android-sdk copied to clipboard

How can I change metallic or roughness factor in runtime?

Open hcjung2000 opened this issue 8 years ago • 3 comments

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.

hcjung2000 avatar Jun 18 '18 00:06 hcjung2000

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 */);

malik-at-work avatar Jun 18 '18 15:06 malik-at-work

You save my day! thanks a lot.

hcjung2000 avatar Jun 18 '18 23:06 hcjung2000

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

chnouman avatar Sep 19 '19 05:09 chnouman