3
$\begingroup$

I'm trying quite desperately to help my wife create a shader (in either cycles or EEVEE) that has a flat color texture but catches the shadows from another object. So picture two image planes one hovering over the over, both with a flat texture, but the lower plane 'catching' the shadow cast by the one above it. It seems programmatically simple but has now eluded me for days. Is this at all possible? I've looked into...

1.. making the lower plane a shadow catcher, but that means it shows only the shadow and no surface texture.
2.. creating two 'lower' planes with one as a transparent catcher overlay.
3.. casting shadows via ray visibility onto an emission shader.
4.. math node multiplying an emission shadow by a diffuse shader designed to recieve the shadow.
5.. using the light path node shadow ray to display a mix of diffuse and emission shaders driven by the same image texture.

EDIT: Added picture. Here I'm just using flat colors not textures but the principle should be the same. I want the red plane to stay flatly shaded, and I want the green plane to also be flat shaded (unlike shown), except that it includes the shadow cast down onto it by the red plane. Viewed from an orthographic camera looking directly down the z-axis it would like the red plane has a 'drop shadow'.

enter image description here

EDIT: Thanks to everyone who helped! For future reference if anyone has this problem the accepted solution is an easy and effective answer to this problem and works in both renderers. I'll note the sun does help but you can easily get away with any light type depending on the strength and radius you use. Softer shadows can be achieved by messing with the interpolation of the color ramp. Casting onto an an unshaded image texture is as simple as plugging the color output from the image texture directly into the MixRGB node.

$\endgroup$
5
  • $\begingroup$ What do you mean by "catching" the shadow? Do you want the whole (lower) plane to be in shade, but still keep some (darkened) color, or do you want the plane to remain unshaded, but "bock" the shadow coming from above it? Also, is there any transparency involved in either of the planes? $\endgroup$ – Christopher Bennett Apr 11 at 20:40
  • $\begingroup$ @ Christopher Bennett. I've added a picture to my original post, the whole lower plane should be the opposite, it should look like it has an emission shader on it. No shading, no light fall off etc, but it would include the shadow as cast by the red place. It would be beneficial if the shadow cast by the red plane could be generated by the alpha of the texture on the red plane (using alpha hashing I believe) but it's not important compared to getting the base idea working. $\endgroup$ – Blender Pretender Apr 11 at 21:20
  • 1
    $\begingroup$ Start by changing the lamp type to Sun: blender.stackexchange.com/a/209929/60486 $\endgroup$ – Markus von Broady Apr 11 at 21:29
  • $\begingroup$ +1 to Markus :) what about Greace Pencil with its modifiers ... $\endgroup$ – vklidu Apr 11 at 21:42
  • $\begingroup$ @vklidu I tried using grease pencil but it's texture fill co-ordinate system seems illogical and unwieldy (no settings in the texture mapping modifier fixed the problem) and when I tired parenting a grease pencil object to a plane, turning on effects and pushing the plane infront of the grease pencil object I got strange clipping artifacts. $\endgroup$ – Blender Pretender Apr 11 at 21:52
5
$\begingroup$

The closest I think I can get is to use a toon-ish style shader on the bottom plane. This leaves the plane flat-shaded, but allows for pure black shadows (remember to set the ColorRamp to "constant"). However, as you can see, the falloff from the point light also gets cast in black as well. This can be solved to an extent by increasing the size of the light source, but doing this causes the shadow resolution to suffer as well.

Here is an example using a point light:

Point

However, if your mesh objects are sufficiently small (can be scaled down), this issue becomes negated:

SmallMesh

As Markus pointed out in his comment, changing the light type to Sun fills out the plane (regardless of the size of your mesh), but the shadow quality properties will likely need to be increased to make the shadow look "cleaner" (less aliased), but it still may not come out perfect:

SunLight

$\endgroup$
2
  • $\begingroup$ @ Christopher Bennet just set it up and that works great! but the image texture or RGB node I feed into the Math (multiply) node becomes desaturated. I.e. My green plane in your example is grey. I see your node has a 'Fac' value and the color built in as a property while mine does not. Am I using the wrong node? $\endgroup$ – Blender Pretender Apr 11 at 22:14
  • $\begingroup$ I used a MixRGB Node set to Multiply, not a Math node. You are correct, a Math node will convert everything to B&W. $\endgroup$ – Christopher Bennett Apr 11 at 22:29

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.