问题描述
我正在尝试在鼠标悬停事件中突出显示游戏中的网格(动画角色等).它们有多种纹理,有时还有皮肤.
I'm trying to highlight meshes (animated characters etc) in my game on a mouse-over event.They have multiple textures and sometimes skin.
我想我会将它们包装成一个 ShaderMaterial 并在命中测试中更改制服以使用片段着色器使其变亮.
I thought I would wrap them into a ShaderMaterial and on hit-test change uniforms to brighten it up with a fragment shader.
要做到这一点,我可以以某种方式操纵常规阴影吗?我可以混合多种材质,让我的着色器从标准着色器中获取颜色值并调整它们吗?还是我需要整个单独的渲染通道并将其与作曲家混合?
To do this, can I somehow just manipulate the regular shading?Can I mix multiple materials, making my shader take color values from the standard shader and just tweak them?Or do I need whole separate render pass and blend it with composer?
或者可能只是其他完全不同的东西,例如环境光仅应用于一个对象/着色器?
Or maybe just something else entirely, like ambient light applied to just one object/shader?
感谢您的任何建议.
推荐答案
转帖,详情/讨论见评论:
repost, see comments for details/discussion:
您可以在鼠标悬停时更改整个材质/着色器,尽管我想这在某种程度上是性能密集型的,具体取决于用户通常执行的开关数量以及应用程序的其余部分正在执行的操作.我曾经使用过的是常规 phong 材质的自发光颜色,例如 material.emissive.setRGB().这也会给你一些不错的效果.
"you could change the whole material/shader on mouse over, although i guess this is somewhat performance intensive, depending on the number of switches the user usually does and what the rest of your app is doing. What i used once is the emissive color of the regular phong material with material.emissive.setRGB() for example. This will give you some nice effects, too".
这篇关于鼠标悬停时点亮物体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!