Reputation: 814
I'm trying to highlight meshes (animated characters etc) in my game on a mouse-over event. They have multiple textures and sometimes skin.
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?
Thanks for any suggestions.
Upvotes: 0
Views: 3608
Reputation: 190
In addition to what GuyGood said, if you do indeed decide to use .setRGB()
on your material you need to use the values of Red Green Blue ranging from 0
to 1
as documented in the Three.js Documentation
Or if you prefer, like I do, the .setHex()
function also exists.
Upvotes: 0
Reputation: 1377
repost, see comments for details/discussion:
"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".
Upvotes: 2
Reputation: 1227
There are some examples of this that you can probably learn a lot from. Take a look at their source:
Upvotes: 0