I am using the examples already given here, i.e. Convert depth/z value to RGBA

The problem I am facing here is to increase the depth. If one sees clearly a blue pattern starts from a close distance of the camera. I need to push it further. Please enter image description here

I have tried changing the values of the nodes but it is not working.

  • $\begingroup$ Is it important to you to map to the full 32 bit resolution? I don't think your reference answer is actually doing that.. the A is not independent, it could be calculated from the R,G and B, and so is redundant? $\endgroup$
    – Robin Betts
    Commented Jun 12, 2019 at 10:08
  • $\begingroup$ @RobinBetts: I am very new to Blender, if you can please elaborate your suggestion more? I didn't understand how to map to the full 32bit resolution, and what exactly to map? $\endgroup$ Commented Jun 12, 2019 at 12:23
  • $\begingroup$ Please describe in detail what you actualy want to achive. $\endgroup$
    – J.Doe
    Commented Jun 12, 2019 at 14:41
  • $\begingroup$ @J.Doe: I need to show the depth of field in a way that an object nearer to the camera should be seen as red and furthest from the camera should be violet. But in the middle, there should be a transition of colour. E.g. as the object starts moving away from the camera it should start to turn from red to orange, then to yellow, then to green, then to blue, then indigo and at the furthest point, it turns to violet. At the moment the object suddenly turn violet(blue in my case) just as soon as it moves a little back from the camera. $\endgroup$ Commented Jun 12, 2019 at 14:52
  • $\begingroup$ @J.Doe: If you see in the first GIF, in the link I have attached, just a little distance away from the camera monkey face turns blue. I want to increase this distance. $\endgroup$ Commented Jun 12, 2019 at 14:59

1 Answer 1


Your setup is fine. You take depth Values (a number of some value per pixel representable as an grey scale image). And dependent on this number you chose a color from the HSL spectrum. So you just need to scale your depth value right to controle for which depth wich color should apere.

enter image description here

  • $\begingroup$ Thank you so much the help :) $\endgroup$ Commented Jun 12, 2019 at 17:29
  • $\begingroup$ Just one question. If need to the same on the material rather than on the view. Then? $\endgroup$ Commented Jun 12, 2019 at 17:30

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