Hi, I have made this moon with nodes:
In game, the sun lamp will being changin its energy and color (because day and night cycle), that would be a problem for the moon, so I can’t leave it to have shading, So I put it the shading by using the dot product of the normal with the light vector of the sun (return by lamp data node).
Everything with that is perfect, and works good.
The problem is that I have the moon in another file and I want to link it to the sky file (and the sky and all that stuff will be linked to the main game file), as the material node is linked, I can’t set the lamp in the node to the sun in the sky file. And if I link the sun (in sky file) to the moon file, when I link the moon to the sky file (which have the sun linked in the moon file), it will not work, because the lamp disappears in the node. I test by leaving the sun in another file, and linking that sun to both file (sky and moon), it works, until I reopen the file, and It stops working.
So I think on getting the light vector from the object color, and change the object color using python.
I test somenthing like this:
light = scene.lights["sun"]
vector = light.getAxisVect([0, 1, 0])
vector.normalize()
moon.color = [vector.x, vector.y, vector.z, 1.0]
But the shadow and color of the moon is always facing to the camera. I guess I have to do some math to transform the vector to world cordinates. Can someone help me?
And do you think that thing about the linked material node and lamps is a bug?