4
$\begingroup$

I'm working on an animation where lot of objects needs to fade in to the scene. I know that I could achieve it by rendering hundrends layers and passes and then spending hours an hours on composition, but I want to do this clean with just materials.

I need material with transparency in Cycles without any X-Ray or back faces effect

enter image description here

$\endgroup$

3 Answers 3

5
$\begingroup$

With Geometry -> Backfacing we can tell the shader to use a Transparent BSDF if the ray strikes the inside of the mesh. This causes some noise that has to run a few samples to resolve (64 - 128 samples should be ok).

enter image description here

$\endgroup$
3
  • $\begingroup$ Ah... Totally forgot about back-facing. Anyways, nice answer. $\endgroup$ Jun 9, 2022 at 16:05
  • $\begingroup$ @YousufChaudhry I like the fresnel answer, though $\endgroup$ Jun 9, 2022 at 17:21
  • $\begingroup$ To my surprise : When I have multiple shapes, which are concave , the X-Ray Effect still exists in this solution. But in simple cases it is great :) $\endgroup$
    – evilferber
    Jun 10, 2022 at 13:44
4
$\begingroup$

You have multiple shapes, which are concave, and what you write about compositing suggests that this is a problem for a much more complex scene that what you're showing us. Backface culling, or anything related, isn't going to work here:

enter image description here

It will still give us your "x-ray effect" when we look through concavity, or we look through two meshes. (It will also affect your shadows when you don't have manifold meshes, which is why these shadows look funny, but that's not a big deal in most situations.)

There is something we might be able to do that will work better:

enter image description here

Here, rather than using a Transparent BSDF to create my basic alpha, I'm using an IOR 1.0 Refraction BSDF. That turns my rays into transmission rays, so I can make further hits, backface or frontface, this object or another, into full transparency. To animate, I'd just be animating the mix factor from diffuse->refraction.

Refraction doesn't quite act right in Blender with regards to shadows, so we can improve this a bit by replacing our straight refraction BSDF with "ghetto glass": we'll mix between refraction and transparency on the basis of "is shadow ray":

enter image description here

This technique requires that you not be using refraction elsewhere in your scene, because these materials will be invisible to any kind of refraction rays, not just the rays they themselves generate. Refraction is not necessarily a frequently used effect, so this might meet your needs.

$\endgroup$
1
  • $\begingroup$ A little tedious to do every time, but I would say, this is a very nice and detailed answer. $\endgroup$ Jun 9, 2022 at 17:50
3
$\begingroup$

Instead of changing the alpha value, you could use a mix shader with a transparent BSDF and set a fresnel node to the factor:enter image description here

You can tweak the IOR to differentiate between a solid and transparent look. As you can see, the backfaces are not visible now.

$\endgroup$
3
  • $\begingroup$ But how to control animation of opacity then? I want to animate opacity. $\endgroup$
    – evilferber
    Jun 9, 2022 at 15:53
  • 1
    $\begingroup$ @evilferber just animate the value of the Fresnel node, press I and set it at 1 for solid, and set it to max and press I to keyframe at the Fresnel node's max value (something extremely high) for transparent. Just like how you would animate the alpha value. $\endgroup$ Jun 9, 2022 at 15:55
  • 1
    $\begingroup$ Looks great! Especially if someone wants flashy fade-in :) $\endgroup$
    – evilferber
    Jun 9, 2022 at 16:04

You must log in to answer this question.

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