I want to create a light source whose light colour will change with ray length.


(light src)______________ | \ \_______ | \ \______ |(red) \ (green) \(blue) (plane)_______________________________________________________________


Enter image description here

The node setup for the lamp:

Enter image description here

  • Ray length as input
  • A power for tuning the value
  • HSV node which shifts the input color depending on the ray length
  • All connected to the color socket of the lamp

The plane which receives the light is just a simple diffuse shader.

An alternative configuration:

Enter image description here

  • $\begingroup$ thanks for comprehensive answer, but i wonder why do i need a separate object to get ray length information and not just create some node setup for a light source? $\endgroup$ – FanciestBanana Jul 24 '16 at 13:52
  • $\begingroup$ Well... in fact, you can !! Sorry, my answer was bad : I rewrite all that ! $\endgroup$ – lemon Jul 24 '16 at 14:00
  • $\begingroup$ @FanciestBanana, I have to say your question above helped me to understand the answer : )... $\endgroup$ – lemon Jul 24 '16 at 14:12

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.