Change color of an object depending on camera view (cycles render) For example I have an object in my sphere. I want the part of the sphere which is behind the object (in the sphere) to be blue and the part which is in front of it to be red.

Is this possible?
Is it also possible to keep it updated if I change my camera view?

Thanks for your help!
It is possible to do that in Cycles using a Camera Data Node

You must use the output of the View Vector socket, separate it into its components with a Separate XYZ node, then pass its Z component through a Color Ramp node to control what colors you get.

The effect might be hard to see at start because the red color would always be off-camera, but tweaking the color ramp node may emphasize the effect.



Should be automatically kept in sync with the camera position