Skip to content
This repository has been archived by the owner on Jul 28, 2020. It is now read-only.

How can I change metallic or roughness factor in runtime? #112

Closed
hcjung2000 opened this issue Jun 18, 2018 · 3 comments
Closed

How can I change metallic or roughness factor in runtime? #112

hcjung2000 opened this issue Jun 18, 2018 · 3 comments
Labels

Comments

@hcjung2000
Copy link

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.

@malik-at-work
Copy link

malik-at-work commented Jun 18, 2018

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

@hcjung2000
Copy link
Author

You save my day! thanks a lot.

@chnouman
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants