Making shadows dynamic from a static template

My scene consists of a bunch of painting meshes (of arbitrary sizes) that are mounted on a wall. I’d like to add a shadow around and below them. I used blender to capture the shadow map around a painting as a template. Dropbox - Canvas_Shadow_map.png - Simplify your life

My intention is to stretch this template on a plane of arbitrary size and place that plane behind the painting mesh and front of the wall. I’d like to understand the best way to stretch the shadow map. I can think of few options, but not sure if any of these are feasible. So before I go too further down in a single path, wanted to get advice from folks:

option 1: Create the shadow plane and stretch the current texture to fit the plane. The issue with this is that the template consists of 2 regions - the dark area behind the painting and the soft shadows around it. The soft shadows will be highly distorted. Say if I stretch the texture 3X its original size then then soft shadows on the left will be stretched by 3x and wont look realistic. What I want is the soft shadows to be of fixed width (but variable length).

option 2: write your own glsl shader. Never done this before so don’t know where to start or if its even possible. Any examples here will be greatly appreciated.

option 3: use Node Material Editor. Again never done it before, so if this is the easiest route - would love to see some examples of similar ways textures are used.

Many thanks.

@PatrickRyan might be able to help next week :slight_smile:

Well, I guess there’s no secret on this matter. You have a number of options (more or less dynamic), either dev/maths- or design- based, and you already stated some in your post.

Obviously, scaling greater than ~1,5 a static shadow map projected on a plane will not provide good results. I guess a possible solution would be to create a set of these scalable up to ~1,5 textures and use the one most adapted to the original size/ratio of the mesh.

Going more dynamic, NME could be a good solution, I believe. I don’t think it would be all that hard to set-up an nme creating a gradient from the mesh size (although I never did it so far, but seems quite feasible in theory).

Twisting things a little and not using shaders, may be setting-up a nine-patch image for a 2D GUI for mesh could also be an option. You could make sure your shadow gradients always remain the same whilst your inner part covers the size/ratio of your mesh.

I guess at some point, there are many ways one could imagine (either on the side of dev or design). Being essentially a designer, I can straight think of another way to twist things. What if for each painted mesh, you would create all assets with the outer shadow in the picture. Next, crop your image/mesh with an opacityTexture; Create a plane behind the mesh of the same size and simply use an inverted opacityTexture and a black or dark color as a BG. I’m sure that could also do the job and would be quite ez to handle in a workflow.

I’m actually eager to read @PatrickRyan answer for this. See if he has other ideas or a different approach (and I’m sure there are many others).

1 Like