Community
Arnold for Cinema 4D Forum
Rendering with Arnold in CINEMA 4D using the C4DtoA plug-in.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Shader color from camera distance

6 REPLIES 6
Reply
Message 1 of 7
pacox21
585 Views, 6 Replies

Shader color from camera distance

Hello 🙂


Is there a way to input the camera distance into a shader to control its color ?


I can't find any solution ...


Thanks for your help !


Francis

Tags (2)
Labels (2)
6 REPLIES 6
Message 2 of 7

You can access the ray length (Rl) via a state_float shader, which is the distance from the ray origin (camera) to the shading point.

Message 3 of 7
pacox21
in reply to: pacox21

Thanks Peter, I'll give it a try and share my progress !

Message 4 of 7

I can't get it to work ... I don't get how to output a Z like render of my surface with a black and white gradient ... Any tip ?

Message 5 of 7
pacox21
in reply to: pacox21

I plug the output of the RL into a ramp_float node, but all I can get is a uniform color, even when I play with the spline or the UV projection

Message 6 of 7

It's an absolute distance (in meters), you need to remap with a range shader.

Message 7 of 7
pacox21
in reply to: pacox21

It works !! Thank you for your help Peter ! capture-decran-2021-02-18-a-152311.png

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report