1
$\begingroup$

I am attempting to make an environment that has hand-painted shadows in the base color texture. This would give me more artistic control over how the shadows are cast. However, I would also like shadows to be cast by moving/animated objects that blend seamlessly with the painted environment shadows.

A good example can be seen in the gif below:

Image by elementrix on Polycount.com

Here, the artist painted in the static shadow on the left while the box is casting a realtime shadow in Unity.

Based on his explanation here, I would imagine this could be achieved by creating an emissive base color texture with a dark/shaded version revealed by a hand-painted mask. At the same time, shadows cast by other objects could be used as additional masks to reveal the dark/shaded texture, allowing them all to blend seamlessly.

Unfortunately, I am at a complete loss as to how this might be achieved and have yet to find anybody else do the same. Is this sort of shader setup possible within Blender?

EDIT: I am using Cycles for this case.

$\endgroup$
  • 1
    $\begingroup$ Hi, Sandberg. You will need to tell us the rendering engine you want to achieve this in in order to get a good answer. $\endgroup$ – Martynas Žiemys Dec 31 '18 at 9:40
  • $\begingroup$ That static shadow isn't painted in, but it is statically cast. NO WAY is it going to be the exact same color unless it were cast here, as hand painted would be approximate and artistically varied. Maybe this - bake your shadows inot a copy of the handpainted textures to get that same value, but then you are stuck with the same lighting after. $\endgroup$ – Craig D Jones Dec 31 '18 at 15:23
  • $\begingroup$ @MartinZ I am using Cycles for this project. $\endgroup$ – Sandberg Dec 31 '18 at 20:03
  • $\begingroup$ @CraigDJones ... still possibly a shadow pass used as a mask between an all-over lit-painted texture and an all-over shadow-painted texture? Not my area, but I'd like to see an answer which did it that way ... $\endgroup$ – Robin Betts Dec 31 '18 at 21:34
  • $\begingroup$ @RobinBetts that sounds overly complicated to repeat even a few times. I hope a proper solution presents itself then because that much manual painting would be a pain. $\endgroup$ – Craig D Jones Jan 2 at 5:38
1
$\begingroup$

Compositing with Shadow Pass Mask

It seems compositing and shadow pass mask is the way to go with this in Cycles.

Once everything is set the render output would be the result of compositing so there is nothing complex to repeat at all. It is possible to hide the extra texture inside the shader with very low emission values that would not add to the 'exposed' visible range of the colors so no extra render layer would be needed and the extra emission shader does't influence the render times in any meaningful way. We could use emission strength of 0.0001 and in compositing just multiply the emission pass by 10000 and since the values are 32 bit floats, there would be no loss in color detail.

You would need to add an Emission shader to all of your materials that would contain the shadow texture for them(even if you wanted the same texture it would need to be there so it does not render black). You also need to have all the passes needed to reconstruct the image enabled. If you needed an emission pass for regular use, some extra masking may be required to separate the actual values from the ones 10000 times weaker, but it could be something like this:

enter image description here

Just to clarify - the emission pass in compositing is multiplied with a simple Color Mix node in Multiply mode entering 10000 as R,G and B values:

enter image description here

$\endgroup$
  • $\begingroup$ Just the sort of thing I was hoping for in the commentary... with a twist. Very useful for NPR $\endgroup$ – Robin Betts Jan 4 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.