Reflection angle for materials


I was trying to make a planetary atmosphere shader (external view) for cycles which does not require a separate render layer and which doesn’t rely on one light source only. What I was trying to achieve is:

  • A smooth fall-off towards the border
  • A smoooth fall-off towards the center
  • Black for the unilluminated areas
  • A subtile color shift towards the unilluminated areas.

I managed to get all points solved exept for the last one, which would require information about the angle between the light ray from the emitter to object and the object to the camera. Is there a way to get this angle from any node?

Best regards,

I found this link a while ago, And its had me thinking on how to model/render this for weeks As a rough pass I would think 4 layers, Land, water, lower atmosphere and upper cloud level atmosphere. But yea. I think I will pull that off no time soon.

Actually thinking about it - Secrop did some work last year on trying to simulate irridescence. He has some complex node groups that involve calculating angles etc. Perhaps look it up or give him a shout - his knowledge is way more advanced than mine.

Yes, but even in my difraction grating shader, the nodes were throwing rays in every possible direction, and it is impossible to check if they reach or not any light source. It works basically because difraction is basically a very structured reflection.

In the case of atmospherics, there’s volume reflection, scattering, absorbtion, and to keep things even worse, each wavelength will reflect, scatter, etc in different ways, depending in the composition of the medium…

One idea that comes to mind would be to use different volume shaders for each wavelength and for each effect. Thought i don’t have the possibility to explore this right now.

A simple way would be to encode the main light direction and position into the nodes, or use python and drivers to make it a bit more automatic… but this will increase the complexity of the shader as soon you start adding more lights… :-\

If, on the other hand, you don’t mind using OSL, you can use the diffuse-ramp closure, which lets you use 8 colors depending on the recieved light.

Thanks for all replies.

The volume shaders would be an alternative, and as far as I understand it, they also deal the colors differently (although I am not sure about this). However, my intention was to make a surface shader as an approximation to decrease the render times. I am aware of the fact that it will never be 100% right with surface shaders only, but that’s not what we expect from most space renders.

So to give an example of what I have, here is a simple brown-colored planet in a blue atmosphere. The node setup for the atmosphere is attached, too. The render is in one pass without any post-processing, and was finished after 17 sec at full HD and 20 samples only. I don’t want to imagine how long a render of equal quality with volumetrics would take.

If someone has any ideas for improvements and the issue above, it would help me a lot!

Best regards,