Forum

User posts scalare
30 September 2017 00:20
OK, so after doing some more research, it seems I have to use replace_image() method in texture module, right?
29 September 2017 18:53
Hi Ivan,

thank you for getting back to me. And how would I do that? I mean, to swap the texture for the normal map only?
29 September 2017 02:19
OK, here is another question related to this issue. Let's say that my scene has a mesh that needs a normal map in its initial material. But based on user interaction, I need it to inherit a material from a dummy mesh from another json file that I will load dynamically like it was explained above. I want those dummy files to be re-usable, so that for example, a red velvet dummy could be re-used and have different meshes inherit from it. But if one of those meshes needs normal maps, the normal map will be lost when it inherits the material, right? Would I have to create one dummy json file per material AND normal map to avoid this? This would generate tons of files. Since I'm going to develop a configurator, the possible combinations could be in the hundreds.

Am I thinking this correctly?

Thanks again.
05 September 2017 01:33
That is exactly what I was referring to. I wasn't sure because I could not find any specific reference in the documentation about when exactly the texture files load did take place.

Thanks a lot, Will.
04 September 2017 16:28
Hello Will, thank you very much for getting back to me.

I guess my question was not clear enough. I've been doing tests with the materials module already, changing values, but also using the inherit_material method. Because of the complexity of the materials we have to work with, I thought that creating them in blender with nodes, and using inherit_material would make more sense. Eventually, we may change the textures on the fly, but that will be an exception.

I understand that all the materials applied to objects in a scene will be loaded when you load the scene, but does that mean that all the textures used for a given material will also be loaded along, even though the objects that use those materials are not currently visible in the scene?

Let's say I create a dummy mesh and apply all my materials to it (they could be more than a 100 materials, many of them using different texture files). And that I have that mesh in the same JSON file as the actual mesh that will get those materials applied based on user interaction. Will the initial load have to wait for all the textures used in all those materials to get loaded, even though most of those materials are not going to be visible at the initial display?

In that case, the dynamic loading of additional JSON files may make more sense. Does this clarify my question?

Thanks again!
02 September 2017 17:51
Hello Everyone,

we're evaluating blend4web to use as one of the tools to develop an e-commerce configurator. The products we'll be selling will be made of different materials and components, but they will mostly include wood and different types of fabrics.

I understand that I cannot control all the parameters in a given material via the javascript API, so to replace a component material we need to define those materials in blender first, assigning them to dummy objects, and then use the inherit_material method. However, I'm trying to understand what would be the best option performance-wise.

I can create all meshes in blender, and have invisible dummy objects in the same blender file, one per each possible material that could be used for that product, and just use the inherit_material to replace the material making the selected product component inherit the material from one of the dummies when the corresponding material thumbnail is clicked in the e-commerce software. Or I could have different blender files, one per each of the possible materials, and use the inherit_material method too, but load the dummy mesh blender file on the fly on top of the current scene first, based on the user material selection.

In the first option, I would have all the materials already available to be inherited, but the initial scene would probably take longer to load. In the second case, initial load would be much faster, but the material replacement would take longer to refresh, since we would have to load the additional dummy blender file on the fly.

I'm not clear on how textures are loaded. Are they loaded into the scene when none of the meshes in the scene is using them? If they are, since we will have lots of possible materials, the initial load may take an extremely long time, and users may leave the site before the scene loads, and in that case, the separate blender files per material approach makes more sense.

Can you please clarify how that works so we can define our approach to the problem?

I hope the question makes sense. Thank you very much!