5
$\begingroup$

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!

$\endgroup$
6
$\begingroup$

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.

Camera Data color ramp

Should be automatically kept in sync with the camera position

Camera Data motion

$\endgroup$
  • $\begingroup$ Are the Nodes referring to the Monkey head or the sphere? $\endgroup$ – Khang Cao Feb 13 '17 at 23:56
  • $\begingroup$ Neither, the nodes read from the current camera position, monkey head is there only for visual reference. The material is applied to the sphere $\endgroup$ – Duarte Farrajota Ramos Feb 13 '17 at 23:59

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.