Forum

Change Node_Material via Logic Editor (Inherit) or JS

21 December 2016 20:04
Hi together,

in the API reference I found no possibility to change a node material dynamically with JavaScript. Is there a way to change it, maybe with inherti_material and loading a full library scene for the materials? I got it working with stack materials but i found no way with node materials so far.

I also read about changing (inheriting) materials wit the node logic editor (example from the SDK). I dont know if it is working the same way with node based materials…

Maybe someone can help me out.

Thanks!
23 December 2016 10:52
Hello and welcome to the forum!

Do you need to change material completely or just some aspects of it?
Will it work for you if you animate value node or color node in the node material?
3D Generalist, contests administrator,
Blend4Web team.
art blog: http://contret-art.tumblr.com/
26 December 2016 18:06
Hello and thanks for your answer,

i need to change the material completely.
I have for example 3 node materials for a metal frame.
- carbon dark blue
- carbon dark violett
- glossy white

for changing from dark blue to dark violett i may use the animate value node via set_nodemat_value.
But i have no clue how to set the color to the glossy white color, without loading the whole new .json model…

So if i have some combinations like white frame with a green decor finish i have to create a new model for every variant and export it again. For a simple product configurator i get thousands of combinations…
29 December 2016 11:04
Hi
So if i have some combinations like white frame with a green decor finish i have to create a new model for every variant and export it again. For a simple product configurator i get thousands of combinations…
You can work around this problem if you create sorta uber-shader with the material editor which you can configure using value nodes via API.
The Founder | Twitter
29 December 2016 14:55
Hi,

I'll give it a try and report back. Thanks for your informations!
 
Please register or log in to leave a reply.