I’m trying to change the opacity of the 3D model on mouse over. Meaning, when I mouse over one model other 3D models opacity should be reduce to some x level say 0.5.
In one of the old post, it is mentioned like, we need to post-processing the gltf model. i.e., adding alpha parameter to the model.
Can I get some sample code to achieve that. If possible, change the opacity of the model on mouse over in the example.
You can use Model.getMaterial to get the ModelMaterial by name. Then, you can use ModelMaterial.setValue to change the diffuse value for the model’s material.
Using diffuse, I could change the color of the model. The model which I’m using is designed in Blender. It is having his own texture. I wanted to change the opacity of the model on mouse over. I believe we could achieve by changing the alpha value. But the model which is imported from Blender is not having the alpha property. As mention in the article, using the alpha property we could control the opacity level.
You might be able to work around this by modifying the renderSate for the loaded technique, but you’d have to dig around the Model object and figure out where it is stored after load. We will eventually support doing what you describe, but I don’t have an ETA.