12
$\begingroup$

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

Example:

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

$\endgroup$

1 Answer 1

13
$\begingroup$

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

$\endgroup$
3
  • $\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$ Commented Jul 24, 2016 at 13:52
  • $\begingroup$ Well... in fact, you can !! Sorry, my answer was bad : I rewrite all that ! $\endgroup$
    – lemon
    Commented Jul 24, 2016 at 14:00
  • $\begingroup$ @FanciestBanana, I have to say your question above helped me to understand the answer : )... $\endgroup$
    – lemon
    Commented Jul 24, 2016 at 14:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .