I'd like to use a non-rendering object (say, a filled-in circle, empty, or a sphere) to control the visibility of another object (say, a grid floor). See image below made with Photoshop. The size of the "mask" object controls how big the visible area of the floor is when rendered. Yeah, I know I can do this in post quite easily, but I want to be able to do it within Blender using cycles nodes.

explanation image

  • $\begingroup$ Yes, this could be done easily if the "mask shape" is circular. You can use a circular gradient texture as transparency mask on the floor object, then use any object as texture coordinate origin using the Texture Coordinate node to control its size. $\endgroup$ – Duarte Farrajota Ramos May 18 '17 at 16:34
  • $\begingroup$ I think I understand what you're saying, but my grid floor is made with a procedural shader and not a texture, so I'd like to avoid using texture masks. Nodes only if possible without additional textures. $\endgroup$ – Safetyman May 18 '17 at 16:53
  • $\begingroup$ Yes, this mask is also procedural, when I mention texture it is not necessarily an image based one, it can also mean a node based procedural texture. The only limitation I see is that said gradient can only be easily done procedurally for basic shapes, otherwise an image texture may be needed. $\endgroup$ – Duarte Farrajota Ramos May 18 '17 at 23:47

If you only plan to use a circular mask you can use the Object option of the Cycles Texture Coordinate node to use any independent object as mapping origin for any texture.

This will allow using that object's position and transforms to control other material or texture through its position relative to the objects said material is applied to.

To do so just create a circular mask (you can do this easily with a Gradient texture set to Circular) and use it as mask to mix between two shaders. In your case mix whatever shader you liek to floor to be with a Transparent one to make it invisible outside a certain radius.

Use a Texture Coordinate probably set to Object coordinates and use the Object box to pick the desired empty - or sphere - to drive its positioning or scale. You can adjust the radius of the opaque part by scaling the empty.

Object Mask

You can achieve other "mask shapes" easily as long as you can recreate them procedurally with the available nodes. Otherwise you will probably have to use an image based texture for that. You can also try Dynamic Paint if you need the mask shape to actually follow some random object shape intersecting with the ground plane.

  • $\begingroup$ This looks like what I was trying to achieve. Thanks Mr. Ramos. $\endgroup$ – Safetyman May 19 '17 at 12:29
  • $\begingroup$ Nice ! And how would you act on the "feather" of the gradient (material>trasparent) ? eg. If I want it "shorter" ? $\endgroup$ – gordie Apr 17 '19 at 20:47
  • $\begingroup$ Run the output of the gradient through a Color Ramp node $\endgroup$ – Duarte Farrajota Ramos Apr 17 '19 at 23:25

apply the Holdout shader to the object you want to use as a mask. It will appear black, but if you want it transparent, activate the transparent option in the render settings under the film panel.

Note that the Holdout shader can only be applied to renderable objects, so empties are not options.

  • $\begingroup$ That kinda works, but the non-transparent area doesn't fade out. I was hoping to get some kind of falloff, imagine something similar to the light from a spotlight. $\endgroup$ – Safetyman May 18 '17 at 17:40

enter image description here

Use a node similar to the one i'm using, you can mix the holdout shader with other "fading" nodes. Note that my transparent octagon isn't casting any shadows or reflections.. thats because I turned off all the ray visibility settings except for camera in the object tab.

  • $\begingroup$ With this setup, I can't seem to get completely transparent. If I turn off diffuse in cycles settings (object) it doesn't work. Turning on diffuse makes the masked areas black... not transparent at all. Not sure what is going on. $\endgroup$ – Safetyman May 18 '17 at 18:22

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.