6
$\begingroup$

It is standard to create shadeless materials by using the emission shader, often with a Lightpath Is Camera Ray to prevent it from casting light on other objects. This creates a flat color regardless of lighting. It does not get any shadows cast on it, and doesn't have any shading on it.

I want to create a material that will not allow any shading on it (so no shadow terminator, same flat color) but WILL allow for shadows to be cast upon it, and most importantly, somehow responds to the overall light level in the scene. In other words, it can change in brightness when in well lit areas, but remains flat.

The purpose of this is to allow for flat shading, but also allow for low light and high key scenes. Currently, the emission based shadeless material will give the same color in a dark room as on a sunny day.

For a full example, consider this material on a character's face: 1)If the light was striking it directly, the whole face would be the same color, which should be the brightness you would have in the brightest area if using a regular diffuse shader.

2) If the character's face wasn't in direct light, it should all be the brightness of the darkest area if it was a regular diffuse shader.

3) If the character's face was strongly lit on one side but not the other (hatchet lighting), it should be fully bright on the bright area, and fully dark in the dark area, which could probably be achieved with some sort of color ramp or have it based on normal.

4) If another object casts a shadow on the object, it should only darken in the area the shadow is cast on, like a regular diffuse. The cast shadow shouldn't be factored into it's shading.

Ideally this would be solved within the material, but compositor options could also work.

$\endgroup$
  • 2
    $\begingroup$ Is there a reason to use cycles for this? It's not a very suitable render engine for the style you want to achieve. In Blender Internal this should be way easier. $\endgroup$ – Jaroslav Jerryno Novotny Jan 27 '17 at 21:05
  • 1
    $\begingroup$ It's possible using internal and compositor. You will need a shadeless pass, a toon pass (for lit areas) and shadow pass. In compositor you need to combine the toon with shadows and multiply that over the shadeless pass. In internal you will get much nicer toon pass, in cycles you will get nicer shadow pass and in both you can obtain the same shadeless pass. You can also use multiple renderers in single project if you duplicate the whole scene (make it linked) and include it in compositor of the first scene. $\endgroup$ – Jaroslav Jerryno Novotny Jan 28 '17 at 10:24
  • 2
    $\begingroup$ Isn't it physically impossible to let a surface with no form of shading/reflection react with its surroundings? Isn't the reason to want something shadeless, because it should have no shades? Could you tell what this should be used for? Maybe we can find another approach? $\endgroup$ – Reaper Jan 31 '17 at 9:14
  • 1
    $\begingroup$ @Reaper yeah it is physically impossible true, but there are non-physically correct ways how to shade a surface. With compositor is should be doable. The only problem is I don't know exactly what the outcome should be. $\endgroup$ – Jaroslav Jerryno Novotny Jan 31 '17 at 21:17
  • 1
    $\begingroup$ @Drudge can you post an example picture what you are after? Can be painted. How the shading should look. There is a text description in your question but it can lead to different looks. Are there only 2 shades (lit and unlit) or do you want shaded gradients etc. $\endgroup$ – Jaroslav Jerryno Novotny Jan 31 '17 at 21:19
4
+50
$\begingroup$

If I understand what you want correctly, you want something the responds to light like a normal diffuse shader, except that it ignores the angle the surface is from the observer. Have you tried simply using a diffuse shader, with the roughness set all the way up, and the surface normal tied to the "Incoming" output from the Geometry node. I may have misunderstood what you want, but it sounds like something close to what you're asking for.

I hope this helps.

UPDATED:

Drudge mentioned that when he tried this technique, he seemingly got it to mostly work, but that the shadows were too harsh for his(/her?) needs. As I replied in my comments, the harshness of the shadow should be directly related to the size of the light source. To demonstrate this, I rendered each of the sample images below twice: Once with a light source similar in size to the sun (as viewed from the Earth). The second image with a light source radius 7 times bigger (I reduced the Strength by a factor of 49 to maintain the lighting intensity. You can actually see the enlarged sun in the reflection on the mirror ball I threw in the background.)

The images rendered below show (on the blue Suzanne):

  • A typical real world diffuse surface shader that should be close to PBR.
  • A raw Diffuse shader with no additional tweaking
  • A raw Diffuse shader with the Roughness set to 100%
  • The setup I suggested above, with a raw Diffuse shader, with the surface normal fed from Geometry: Incoming, and the Roughness set to 100%

If you can point out where these images differ from your expectations, I'm happy to attempt to correct the problem.

Comparison of different permutations of this technique

$\endgroup$
  • $\begingroup$ Can you explain a little more about what this is actually doing and why? Thanks. $\endgroup$ – Drudge Jan 31 '17 at 19:59
  • 1
    $\begingroup$ Usually several things contribute to the color of a surface. For a surface to respond to the light around it, while being mostly a flat color, you would use a diffuse shader. You wanted your surface to accept shadows, and pick up the lighting conditions it's in. The only thing a diffuse shader does besides that, is vary the color intensity by viewing angle, which you said you didn't want. By tying the normal to the Incoming output, the surface renders as if it is always facing the camera, so it no longer changes with angle. Increasing the roughness adds to the surface flatness too. $\endgroup$ – Loren Osborn Feb 1 '17 at 4:21
  • $\begingroup$ Here's a related question about how roughness affects the diffuse shader: blender.stackexchange.com/questions/5167/… $\endgroup$ – Loren Osborn Feb 1 '17 at 13:33
  • $\begingroup$ Incoming output into normal shader input does not work. Have you tried it? $\endgroup$ – Jaroslav Jerryno Novotny Feb 1 '17 at 19:25
  • $\begingroup$ Sry, i tried this and it doesn't work. It looks weird if you use the normal $\endgroup$ – Reaper Feb 2 '17 at 8:02
5
$\begingroup$

We can use compositor tricks as you proposed.

Scene

I am going to set the scene such that the shadless objects are in one layer and the others in another.

Add another render layers to catch shading information:

I am going to create a new render layer with exactly the same layers but I am going to set the Material override to a material which is just a diffuse shader. And another one which with the same setting but with excluding the layer with the non shadless objects.

Shading layer:

Passes

Shadow layer:

another

Matrials

The material for the object should be as you described, an emission shader with camera ray as input.

Compositing setup

Since we enabled all passes, we cal selectively apply the only shading we want.

Example 1: Shadows that other object casted:

By subtracting the shadow if the shading layer from the shadow if the shadow layer and then inverting it, I get the shadows that were only casted from other objects and not the object itself.

shadows

Example 2: Adding highlights:

I can add the diffuse direct of the shadow layer to the result to get highlights and I can use Indirect lighting.

highlights

And you can play with passes to get exactly what you want.

$\endgroup$
  • $\begingroup$ But now, it's still shaded.. $\endgroup$ – Reaper Feb 2 '17 at 8:01
  • $\begingroup$ @Reaper It is not shaded, you have control over every thing $\endgroup$ – Omar Emara Feb 2 '17 at 11:18
  • $\begingroup$ The monkeyhead is uneven lit. Hence it's shaded. $\endgroup$ – Reaper Feb 3 '17 at 18:08
  • $\begingroup$ Don't do the second step then, what else you want to achieve? $\endgroup$ – Omar Emara Feb 6 '17 at 20:18

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.