How to set opacity of each nodes

好久不见. 提交于 2021-02-10 14:21:06

问题


Is there anyway to set opacity of some nodes of the model?

For instance, create a override material and use it in renderer for some nodes rather than whole scene.


回答1:


When loading a model, the viewer builds its internal spatial indexing structures (BVHs), and one of the factors it takes into account is the transparency of the different fragments. This is in order to ensure that semi-transparent objects are rendered after the opaque ones.

However, when changing the material of a fragment on-the-fly (after initial load of your model), the order is not updated because the viewer doesn't have a way to rebuild the BVHs on demand, and you can end up with something like opaque objects hidden by transparent ones ... We have a pending change request in order to add an API that would allow developers to rebuild BVHs, unfortunately it has not yet been added yet.

You may take a look at the following resources for example of modifying materials in the viewer:

Autodesk.ADN.Viewing.Extension.Material

Forge Viewer Custom Shaders - Part 1

Forge Viewer Custom Shaders - Part 2

Custom transparent meshes with View & Data API

Hope that helps




回答2:


Yes, sure.

The ForgeFader app creates and sets override materials on certain nodes in the viewer:

Check it out in:

src/client/viewer.components/Viewing.Extension.Fader/Viewing.Extension.Fader.Core.js.



来源:https://stackoverflow.com/questions/43974100/how-to-set-opacity-of-each-nodes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!