Forum

Shape Keys & Shadows

06 February 2018 16:23
I'm trying to get shadows to work with shape keys — to move as the shape key moves. Does anyone have any suggestions?

I've attached a gif of what happens now — the object (cube) moves but the shadow doesn't. I've also attached the file that created the gif.

One partial solution is to pre-render the shadow and scale it (programmatically) with the shape key. This works great for cylindrical objects where x and y scale evenly (the shadow looks better too). But I found out you can only scale objects uniformly — you can't scale x & y independently — so that doesn't work for objects like this cube.

Maybe I could use ambient occlusion — simply show some darkness where the cube and the shadow plane meet? I've used similar approaches in other programs, but I can't seem to get it to work with blend4web.

Any other thoughts or suggestions?

Thanks for your help.

— Jeremy

Note: I'm using OSX so I get the warning that blend4web is applying a "shadows hack". I don't know if this works differently on a PC, but I need to support OSX and iOS anyway.
09 February 2018 16:40
I'm trying to get shadows to work with shape keys — to move as the shape key moves. Does anyone have any suggestions?
Hello,

shadows should work fine with shape keys (example: morphing code snippet).
How do you update shape keys values?
Blend4Web Team - developer
Twitter
LinkedIn
15 February 2018 17:29
Hmm.. the code snipped works well on my computer but the blend file I attached does not. I'll try to figure out what I did differently.

I was using
m_geom.set_shape_key_value()
and using the sliders in the blend4web viewer.

Things that didn't change anything include making the object and shadow plane dynamic and making the shadow plane opaque. I'll try some other things.

Thanks for your help.
 
Please register or log in to leave a reply.