I am trying to pick up the sun vector for each frame of a sun study via the RKP rendering pipeline (in OnRenderBegin). I may be doing something wrong - however each frame of the animation has the sun in exactly the same Alt/Az & vector (which is the actual sun position in the Viewport - not the sun position setup in the animation). How can I pick up the sun director of the frame actually being rendered pls? Flythru’s do not have this issue - the camera position is being provided correctly.
This is my code in OnRenderBegin
LightTable lightTable = Rhino.RhinoDoc.ActiveDoc.Lights;
if (lightTable != null)
{
Sun sun = lightTable.Sun;
if (sun != null && sun.Enabled)
{
sunVector = sun.Vector;
}
}
If you are using Rhino’s built-in sun study animation, then the reason is that it doesn’t use the document sun. It actually adds its own directional light to the scene.
Hi Paul,
Not sure what you mean by 8 directional lights.
AnumationTools creates one new directional light in the first frame. Then it deletes/adds (basically replaces) the light when capture the next frame. When done (all frames captured), the last directional light is deleted.
Thanks for this info. I finally got around to look at this again. In summary, the LAST light in the light table seems to be the sun direction from the Sun Study, and a new light get added each frame. However there are some complexities, because there does not seem to be any way to determine if a Sun Study is currently being rendered - so the plugin does not now whether to use the Rhino.RhinoDoc.ActiveDoc.Lights.Sun, or the Rhino.RhinoDoc.ActiveDoc.Lights[last light] for the sun direction.