Mix shader fails with OSL

Hi there,

I am working on a small animation of Mars with a texture for the day side and a texture
for the night side.

I found some solution in different tutorials on how to achieve similar results but they all seam to
to complicated.

Therefore I created my own material simply based on the vector between light source and object
and the normal vectors. And as it should be, but only without OSL.

Unfortunately I also wrote a small shader for the atmosphere and need OSL.

The attached images are show the material and the preview render without and with OSL.

Is there any solution for my problem???

night_test_02.blend (528 KB)



If you do it like the picture below you will obtain a dynamic effect that trully reacts to the direction of the light and gives a kind of planetary occlusion effect:

If you mute or reroute around the Vector Transform node it seems to work.