Git Product home page Git Product logo

Comments (3)

lslzl3000 avatar lslzl3000 commented on June 2, 2024

你这个需求是具体的业务层面逻辑了,核心是动态修改 material 的 alpha 值,并配合 blendMode 来渲染半透明状态

let mesh = obj.getComponent(MeshRenderer);
let mat = mesh.material;
mat.alphaCutoff = 0.1;
mat.baseColor.a = 0.5;
mat.transparent = true;
mat.blendMode = BlendMode.NORMAL;

具体的来说和模型的结构、名称、逻辑都有关系,我们拿一个简单的模型来举例
https://codepen.io/orillusion/pen/rNozgPJ

ezgif com-video-to-gif

具体的实现方法可以参考 codepen 的代码

from orillusion.

Temurayl avatar Temurayl commented on June 2, 2024

那假如说,我在一个场景中加载了30个模型,触发了一个按钮的点击事件,然后想让这30个模型中的指定5个模型添加这样一个透明度的话,和这个示例是一样的操作吗?
还是说有更好的方法呢?

from orillusion.

Temurayl avatar Temurayl commented on June 2, 2024

mat.alphaCutoff = 0.1;
mat.baseColor.a = 0.5;
这两个属性取值区间范围都是 0-1吗?

from orillusion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.