1
$\begingroup$

I want to hide a part of a mesh like the red part on the picture below : enter image description here

I think I can do that with the compositor by rendering a mask, but I would like to know if I can do that directly trough a material.

using a transparent shader is not a solution, see the picture below : enter image description here

$\endgroup$
3
$\begingroup$

Just assign a fully transparent material to that part of the mesh.

enter image description here

$\endgroup$
10
  • $\begingroup$ not a solution, test with a cylinder, you'll render the other faces. $\endgroup$ – The Unholy Metal Machine Nov 15 '14 at 20:50
  • $\begingroup$ I think your question needs to me a little more clear. Part of the confusion might be due to two reds in your example - the plane, and the squiggle $\endgroup$ – ajwood Nov 15 '14 at 21:13
  • $\begingroup$ the question is "can i use the background as texture" not can I set something transparent $\endgroup$ – The Unholy Metal Machine Nov 15 '14 at 21:18
  • $\begingroup$ I doubt it's possible outside of the compositor. Will be interested to see what others come up with though. $\endgroup$ – ajwood Nov 15 '14 at 21:36
  • $\begingroup$ @bob-Zombeaversbreeder are you sure the transparent shader is set to pure white? $\endgroup$ – PGmath Nov 15 '14 at 21:57
1
$\begingroup$

Instead of using a mask you could also use a holdout shader. But if you are using a holdout shader you still have to do compositing later.

$\endgroup$
3
  • $\begingroup$ The holdout shader seems to be equivalent to a black emission shader, unless the film is set to transparent (blender 2.71). Is that expected? $\endgroup$ – ajwood Nov 16 '14 at 16:21
  • $\begingroup$ "A holdout shader is useful for compositing, to create a "hole" in the image with zero alpha transparency where the object with this shader is located." - from the Blender 2.6 Documentation. So yeah, it only works in conjunction with a transparent film. $\endgroup$ – therufuser Nov 16 '14 at 16:24
  • $\begingroup$ Renders often have an alpha channel even with non-transparent film, albeit a boring all-1 alpha channel. I would have thought that this shader could use the alpha channel, if it's there, regardless of the background film. $\endgroup$ – ajwood Nov 16 '14 at 18:13
0
$\begingroup$

I found a way to achieve, what I think is what you want, using the Transparency depth output of the Light Path node.

enter image description here

For this to work, you need to create to new materials for you object: enter image description here enter image description here

Material 2 is assigned to the front face, and Material 1 to everything else on the cube. The back cube and the floor have a different material assigned.

The Light Path node gives your material information about the current ray that is being cast through your scene (Cycles casts virtual light rays through the scene for physically correct rendering). The Transparency depth for the ray increases every time this ray passes through a transparent shader (the front face of the cube in this example). Now we can pass that information into a mix shader to control make the material transparent for light rays, that already passsed through a transparent layer.

Please note, that any transparency in the scene will affect Material 1, making it invisible. If you want to make a different object disappear, just assign Material 1 to it and you can use a transparent object to hide parts of it.

There are obviously a couple of things to tweak about this setup, but I think it's a start.

$\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.