algorithmic modeling for Rhino
Hi all,
Does anyone have a clue about animating sun position (vray / other render engines) and camera through grasshopper? I'm trying to produce an animated visualization of the shadow effects throughout a day.
i'm currently using Giulio Piacentino's animation ghx to animate geometry but is there a way to also control where the sun and camera go throughout a day?
Thanks!
Otto
Tags:
Sure:
- Create a directional light in Rhino using the 'sunlight' command.
- Reference this light inside Grasshopper using the ID parameter.
- Place a VB component and connect the ID parameter to the x input.
- Find a definition (they are everywhere) that translate lat/long/date into a vector.
- Connect this vector into the y input of the VB component
Insert this code into the VB component:
Dim obj As New docobjects.ObjRef(x)
Dim l As light = obj.Light
l.Direction = y
doc.Lights.Modify(x, l)
If you are using a renderer like Brazil that uses the new document sun, you can change its position directly using date and time values using
doc.Lights.Sun.SetPosition()
But while testing it it seems to keep defaulting to "manual mode" and there's no way through rhinocommon to disable this. If you disable it manually the date is set correctly though.
Sorry, I didn't notice you also asked for camera position.
To change camera position create a VB component, connect into the x input the camera location and into the y input the camera target (both are point data) and insert the following code:
doc.Views.ActiveView.ActiveViewport.SetCameraLocations(y, x)
Welcome to
Grasshopper
© 2024 Created by Scott Davidson. Powered by