1
$\begingroup$

I feel kind of dumb, it seems like this should be relatively simple. I'm trying to make one level of my NPR shader transparent. I've attached a screenshot to show what I'm trying to do.

$\endgroup$
  • $\begingroup$ I tried that to no avail, I feel like I'm missing some basic step. Haha I feel dumb, seems like it should be simple $\endgroup$ – Remington Nov 7 '19 at 2:44
  • $\begingroup$ Try adding in the alpha this is transparency often gas issues. $\endgroup$ – Yohello 1 Nov 7 '19 at 16:38
0
$\begingroup$

I believe I see the problem: the Color Ramp's alpha information is available (in its second socket), but is not being passed on to the surface shader (only RGB, not RGBA, is being forwarded to the surface values). If we're willing to move back into shaders before the final render (as opposed to the raw color-to-surface pipeline), then we could switch from this, which does not respect alpha to clip:

enter image description here

To this, which does:

enter image description here

I am not sure if there is a way to get transparency information properly incorporated in an RGBA sense into shader nodes without using at least a single penultimate shader (rather than just color information). Someone more knowledgeable than I am may be better positioned to comment on that, though, or maybe to explain why that appears to be the case. This is certainly unfortunate, since adding the penultimate shader removes the non-photo-realistic flat-shading effect that was presumably the point of using Shader-to-RGB in the first place. The only alternatives I am aware of involve post-processing/compositing to remove the regions intended to be treated as transparent.

As a partial fix, I find you can recover flat shading while retaining transparency if you use an emissive shader where you would normally use a diffuse shader, after the shader-to-RGB transformation (so that lighting information can still affect where transparency appears, as a result of the initial diffuse shader node):

enter image description here

This probably has its own disadvantages, although the most obvious objection (that it won't react to lighting information) does not seem entirely relevant (since lighting information can still affect at least the extent/shape of the emissive node's coverage through the initial diffuse shader node that precedes the Shader-to-RGB node).

For completeness, here are my previous, incorrect speculations, which may still be valuable to users with similar problems:

ORIGINAL: You probably just need to change the material's blend type from Opaque (the default) to one of the Alpha-aware blend types. Alpha Clip is a common suggestion. This is where the setting is located in the materials tab:

enter image description here

EDIT1: There is, also, a general setting for whether alpha information in pixels will be filled with Sky or Transparency in the Render->Film settings.

$\endgroup$

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.