How do I make an object cast shadows but be invisible in the render? I want an object to affect light (cast shadows) but I don't want it to be visible in the image. There should be a way to do this?
In Cycles or Eevee, that can be:



It uses the light path, testing if it is a ray from the object to the camera: if yes, the transparent shader is used.

For Eevee, you need to set the blend mode to alpha blend: