Material Selections

16 October 2014 21:46 #273
Hi All!

Blend4web is a very interesting new way to go about web presentation and apps. I had been playing around over the past few years with some ways to do some Architectural Visualization. This seems to have the best promise for what I want to do, but I'm very newbie when it comes to programming. (I can write some Excel formulas, but that's about it ) I'm always willing to dig into what I need to get the result I'm looking for though.

I've started a quick little test for an idea to click on objects and have a menu pop up to change the material. I plan on baking all the materials in the scene in Cycles for a more photo-realistic look and better performance. I currently have no idea how to go about adding click sensitivity to bring up a menu or list of materials to change on the object. I plan to start looking through the tutorials in the coming months to try to figure things out, but if there is something specific I should look into, any direction is welcome.

Kitchen Viz

Here is the test I started to just see how Blend4Web would work. So far, I love the results and the potential. It even runs on my tablet without a hiccup.

Thanks for joining in the development in Blender as well! This is all fantastic!
16 October 2014 23:21 #274
Hello Zakaro!
And welcome to our forum!

Wow, looks great! And it reminds me kitchen stuff we've bought not long ago
Have you seen our Mi-34 demoscene? Here is an example of this possibility. And it was done without programming
Instead of it we used special functional based on NLA. Here I made a little example of using it. But there is one thing - soon will come out our new release, and this feature will be improved, so right now there's no actual point in thorough description of almost "old" functional And we will make a tutorial (maybe tutorials) including that improved feature :)

By the way, I can try to describe how it works according to material. I assume you need your texture to change by the click, right? So, there is one method, I think, the easiest one. Let's think we already know how to use our new NLA functional. So we speak about material itself. First - I hope your materials are made in Node Editor :) Because I don't know the way to do this trick with stack materials. So, we got node material. And in it we have two textures - the first will be replaced by second when we'll click. So they both go to colors in node color mix, and in factor goes input->value. This value is animated: it changes from 0 to 1 in, let's say, 5 frames. So now we have an animation - Tex1 changes to Tex2 due Mix factor. That's all! All we need now is to make this animation play by click. You can see an example I mentioned earlier - there is animated value, too. Well, it animates UV-shifting, not just mixing, so it's a little more complicated, but it shows overall how it works.

Hope it will help
3D Generalist, contests administrator,
Blend4Web team.
art blog:
17 October 2014 20:58 #282
I wasn't fully aware that the Mi-34 scene was done entirely w/o programming or scripting. I hadn't had time to read the article on it when I first looked at it. That's excellent! I unfortunately have never used the NLA system in blender, so I'll have to dive into it! Another unfortunate thing is I don't believe I have my materials in nodes. I use the node editor for Cycles, but when having to convert those to the BI renderer, I don't use the node system, as I'm not familiar with BI node setup. I'm sure it's not too different to learn than cycles though. Now, if I didn't have to export the scene for Blend4Web from Blender Internal renderer and could do it from Cycles, that would be awesome! But, I'm guessing there is more difficulty in making that happen, otherwise you probably would have done it since Cycles is the renderer that is being actively developed in Blender.

Thank you very much for the sample you pointed me to and the NLA direction. I'll look into it and post some progress when I get to doing more.
18 September 2015 20:55 #3926
Well, after a long time of not touching or looking into this much further (due to busy work season), the latest addition of the Logic Editor peaked my interest again. As more of an artist and tinkerer than a programmer, this is THE BEST THING SO FAR to hit Blend4Web. (this is my opinion of course )

I dabbled a little yesterday and thanks to mister Will Welker for the YouTube tutorial posted today. I have once again tried my newbie hands at this. Here is my go at it and my first success at what I'm looking to do. Now, I have to work on learning how to dynamically load textures, create a canvas for a separate window displaying all options, optimizing, and testing.

Countertop Selector

For those interested in how this was done:

I keyframed (press "i" at the right places on the timeline) the "Value" nodes of the Material for the countertop. "0.00" value allows the top color (texture driven) to go through. "1.00" allows the bottom to go through. Layer this as I have in the photos and you can have any number of textures to change to.

Then set NLA markers at the appropriate positions to be used in the Logic Editor.

Is this the best way to go about this or is there a better, cleaner way to do this without having to code any JavaScript?

Finally, THANK YOU B4W team for your continued effort to make this tool easier to use for the "programming challenged".
19 September 2015 02:47 #3928
Hey, very nice. I will follow your progress on this. I want to make a spherical image viewer that changes the environment picture dynamically. Looks like you have it working.
Blend4Web Videos
19 September 2015 15:13 #3935
I'm glad my tinkering helps others as well. I had somewhat of an idea of the Sphere app you created as well when I first started taking sphere pictures earlier this year and you helped me to make it happen.

Looks like you have it working.
Well, I have SOMETHING working. I'm not sure if it's the best way to go about this though. This easily and quickly becomes very messy when just adding a few more things to it. (example below)

I added 3 more texture options, and I can see how keeping track of what values need to be at the right time can become daunting with a large amount of this. The Logic nodes are even crazier:

I added the 3 more texture changes plus added the texture "buttons" start hidden until clicking the Countertop.

I do understand that programming can be very tedious in making sure every line is correct, so maybe this is just the visual result of that, but I can't help but feel I'm going about it wrong. It's getting the desired results, but Is this the intended way for it to work the best?
21 September 2015 12:20 #3972
Hi Zakaro,

There will be a new "Select and Play" node in 15.09 which will reduce the number of nodes in the middle part of your node tree twice. Furthermore, we are planning to add node groups to logic nodes (but not in the nearest release), which will simplify the structure significantly.
Blend4Web developer
21 September 2015 19:43 #3993
Fantastic! Thanks for the update, Evgeny. I look forward to the improvements.
03 December 2015 13:27 #5615
Hi there :)

I`ve try to rebuild the Node- Setup from Zakaro (Countertop Selector). But it didnt work :(
I guess, I dont understand how the Action (markers) work?
It would be nice if someone can give me a hint.

I`va made a simple scene… A Monkey with three Matcap- Textures.
The cubes should change the Textures on the Monkey.

My Blend:
03 December 2015 15:12 #5620
Hi Tomekk and welcome to the forum,

You should enable the "logic editor" option to export your logic node tree:

I have corrected your node tree for one cube
Please register or log in to leave a reply.