Forum

User posts Blend4Life
22 July 2017 21:27
I only can't get, how a 3D model needs to be prepared for such a manipulation
You just have to change images dynamically. Here is an example:

https://www.blend4web.com/apps/code_snippets/code_snippets.html?scene=change_image
22 July 2017 20:33
Thanks everybody!

Juani, your solution is fine and works 100%. However, correct me if I'm wrong, in this solution you have to create and bake the bone animation seperately and push it down the NLA stack before you can even start adding armature keyframes. That would make it very hard to create/work on real-life animations because usually you have be able to tweak both things at the same time.

Here's the solution I found:

You parent the armature to a "driver object" and do the loc/rot keyframing on this "driver object" instead of the armature itself. The driver object will move around and the child (the armature) will follow every translation/rotation. This will play without problems equally in Blender & B4W, and you can freely edit everything at the same time. In fact, you don't even have to bake for test runs (although it must be said that unbaked animations played in B4W may show aberrations, so you should definitely bake the final product).
17 July 2017 08:20
I have an armature object with a skeletal animation, but the armature object itself also has keyframes on its LOC/ROT. This plays fine in Blender: The bones are animated and the armature itself moves/rotates as well. But Blend4Web only plays the skeletal animation, while the armature stands still.

I'm unsure whether this is due to me making a mistake or if this is not supported, because the manual states:

"A simultaneous playback of different types of animation for the same object is not supported."
18 June 2017 01:00
This is true even if I set the z-index of the anchor divs greater than the canvas div's z-index (which should bring them up to the front).


Another question about anchors: I would like to use custom anchors, but keep the design of the default anchors (as they are in the planetary example). But if I use custom anchors without supplying css definition, it looks like the anchors will have no design at all. Can you point me to the css of the default anchors so I can copy it?
01 June 2017 20:26
Thank you guys, I didn't realize that you have to pass the world name as your object name (I usually go by the API manual and it doesn't even mention that this is possible). I somehow failed to notice the tablecloth snippet's source code where this is demonstrated.

For anyone interested, first you make a World node setup (in Cycles Render Mode) with a value node to drive world strength, like this:



With that setup, the code for changing the image is:
var _world = m_scenes.get_world_by_name("World")
m_tex.change_image(_world, "env_tex", "path_and_filename_of_your_image_texture", name_of_callback_function) // pass "null" if you don't need the callback

And for changing strength, it is:
var _world = m_scenes.get_world_by_name("World")
m_mat.set_nodemat_value(_world, ["world_strength"], your_strength_value)


Cheers!
30 May 2017 08:21
I'm interested in changing (dynamically) the strength value and the image itself. Is this possible?

Also, it would make a lot of sense if this texture (and background textures in general) were affected by B4W's color correction parameters (Brightness-Contrast-Exposure-Saturation), don't you agree? These simple parameters can be used to great effect, for example to simulate foggy/rainy weather or animate lightning, but I cannot make the background play along and this is what keeps such effects from looking convincing.
22 May 2017 22:06
Let's say you simulate a forest with a (hair) particle system, so you model a tree as your dupli object and set its material to collision. Will the particles (trees) scattered around the scene then react to collision? When I tested this, it failed and I could walk right through the instanced trees. Maybe I did it wrong, or is this a limitation of the engine?
22 May 2017 21:24
For now there is a little hack: you should just click twice (enable then disable) "Apply Modifiers" property for the object. Then modifiers won't be pre-applied.
Yep, that worked.

For now Array modifier is the only one that can be processed dynamically.
Well, one could create a Mirror modifier from a 2-count, no-offsets Array modifier by adding an Empty at the same location, then setting the Array modifier's "Object Offset" to the Empty. You can now create mirror effects by manipulating the Empty (rotate Z by 180 degrees or set scale to -1 on the axis to be mirrored).
21 May 2017 08:19
One would think that using these modifiers (and NOT applying them before export) could be used to keep filesize low, but apparently this is not the case.

I tried using an array modifier with a very large count to test this, and to my surprise, the exported .bin filesize increased along with the array count. My expectation was that the engine would apply the array after reading the files, so that mirrors and arrays could be exploited to cut down massively on filesize.
15 May 2017 23:46
A new version came out (17.04) that supports Cycles World Material nodes and even equirectangular images, so I'm using them from now on.

Awesome!