1
$\begingroup$

I know it's been said a thousand times. I've looked. But, nothing has worked. I'm using a CellShading Shader I made, and I need to bake it. I can't do this without switching to Cycles, though, and in Cycles, my Shader appears black.

I tried fixing it by following a post that said to convert the final color to a Diffuse BSDF, but that also didn't work. What can I do to fix this? If any more information is needed, such as my full shader, etc., please ask me.

CyclesImage

$\endgroup$
1
  • $\begingroup$ If you don't mind the edit, I took the freedom to properly embed your file in the question. $\endgroup$ Mar 10, 2023 at 6:43

3 Answers 3

0
$\begingroup$

The reason the object is coming out black is because you have 2 objects occupying the same place (one of them being black). Cycles does not like overlapping objects and will often yield black as a result (expecially if there is transparency involved). As you can see below (Image 1), in Material Preview mode (which uses an EEVEE based renderer), the black object appears as a nice black outline (as you intended), however in cycles (Image 2), the result is black, even with the "Correct" one (with the appropriate shader) selected.

Mball1

Mball2

$\endgroup$
16
  • $\begingroup$ Thanks for the response, but I switched to rendered preview, and also changed the Material Output to All, but it's still Black in preview and when Baking $\endgroup$
    – rezarg
    Mar 10, 2023 at 4:00
  • $\begingroup$ Did you check if you're using Cycles rendering engine in the first place? $\endgroup$
    – HikariTW
    Mar 10, 2023 at 4:01
  • 1
    $\begingroup$ @HikariTW, yes, I'm using Cycles $\endgroup$
    – rezarg
    Mar 10, 2023 at 4:02
  • $\begingroup$ I also notice the color of your material output node is wrong (grey, as if there were 2 and it was the "unselected" one - "selected" one should be red) - any chance you have a second material output node in your graph? $\endgroup$ Mar 10, 2023 at 4:03
  • $\begingroup$ @ChristopherBennett I only have one output node $\endgroup$
    – rezarg
    Mar 10, 2023 at 4:04
0
$\begingroup$

The preview panel you used is EEVEE instead of Cycles

enter image description here

Since you explicitly tell the shader that only output to Cycles engine, EEVEE doesn't get the result from shader.

You can either:

  • Changing the output to all (yet if theres some invalid nodes for EEVEE, it might not work)
  • Changing the Preview panel from Material preview to Rendered using Z (hold), and making sure you are using Cycles as your rendering engine
$\endgroup$
0
$\begingroup$

Here's an additional answer just in case you might want to create an outline object in Cycles. Of course you can use something like Freestyle or a Line Art modifier, this is just an alternative method. Although I think you're better off with Eevee since you use a lot of Shader to RGB nodes which simply cannot be used in Cycles.

As I said in the comments, Cycles does not use Backface Culling, it is only available in Eevee. Nevertheless there is the Geometry node in the Shader Editor which has an Backfacing output. This can be used to mix between a shader that creates the outline and a fully white Transparent BSDF to make the backfacing parts invisible.

I also woudn't recommend using a Principled BSDF for the outline because I guess you want a solid color outline and not reflections or anything on it. For a solid black outline the shader is very simple to create: Take a Mix Shader and plug a Transparent BSDF in the second Shader input, then plug the Backfacing output of a Geometry node in the Fac. The backfaces will be transparent and the front faces will be pure black without any shading (since there is nothing in the first Shader input):

black outline

This is when using your model, where you have already flipped the faces inside out to make the Backface Culling work. However, with the Backfacing output you wouldn't even have to flip the normals - you would simply plug the Transparent BSDF in the first Shader input.

Now this was the setup for a simple shadeless black outline. If you want to use a color (that's also shadeless), you have to plug in an Emission shader with a Strength of 1 into the other input. But that brings up a problem - the emissive color now illuminates the inner object from all sides becauses it encloses it completely:

green outline illuminating scene

So in order to make the outline only visible for the camera and not affect the rest of the scene, you can go to the Object Properties > Visibility > Ray Visibility and disable everything except Camera:

ray visibility

Now you just have the outline without any light shining on the other objects.

green outline

What is a little bit inconvenient though is that would have to change the Visibility settings on each object that you want to work as an outline. With a slightly more complex shader setup this won't be necessary though: if you take another Mix Shader node and a Light Path node, you can use the Is Camera Ray as mix factor between the Transparent BSDF plugged in the first Shader input_ and the result of the first Mix Shader into the second input. This makes the camera see the outline correctly while for the rest of the scene objects the outline is completely invisible and thus does not illuminate anything. This way you can simply put this material on any object that should work as an outline without the need to change the Ray Visibility settings (although for Eevee you still would have to change settings per object).

setup with light paths

In the above screenshot the first Mix Shader is set up for non-flipped normals, just in case you're wondering. By the way, with this setup you can use the outline in both Cycles and Eevee. To make it work in both you can use the following variations:

  • The normals of the outline objects are flipped - in this case, the Transparent BSDF goes into the second input and for Eevee you can either enable Backface Culling or set Blend Mode to something else then Opaque like Alpha Hashed for example.
  • The normals are oriented correctly - then you plug the Transparent BSDF in the first input and you cannot use Backface Culling in Eevee but have to set Blend Mode to something like Alpha Hashed.

Now the only problem you might have is when you have Bloom activated in Eevee or want to add some glow in the Compositor, the Emission shader will be glowing. You might have to adjust the Threshold to some value that the outline does not start to glow and other objects that should glow are brighter, or work with masking in the Compositor (but that's stuff for a different question on how to separate those things in compositing).

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .