Announcement

Collapse
No announcement yet.

V-Ray Next Animation from Grasshopper

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • V-Ray Next Animation from Grasshopper

    Hi,

    I have trouble with my workflow for animations after migrating to V-Ray Next.

    With earlier versions I have used a simple C# component to trigger rendering with Rhinos Render command. The script would then wait until the render finished and save the frame, before incrementing the frame number and repeating the process.
    This worked like a charm, while having the "Batch render" option ticked in V-Ray. As far as I can see this options has disappeared.

    Thus, I tried to migrate to the official Grasshopper components.
    This seems to work ok with one missing input: the camera up-vector / rotation/tilt around camera axis. (I'm trying to match the animation with a drone-shot)

    If there is a way to enable the old method of setting up an animation render ("batch render" option) that is the easiest as I can change the camera from the script before triggering a render.
    This would also make it possible to change material settings and/or textures frame by frame with the V-Ray Scrip Access.

    In general I think moving the trigger render button in Grasshopper from the right-click menu to an input that can be triggered with a boolean toggle or button etc. would make it a lot more flexible.

    I hope there is a solution that I have missed or hidden options accessible from the V-Ray Scrip Access.
    Last edited by HOEN_ARKITEKTUR; 05-08-2019, 04:49 AM.

  • #2
    Hi HOEN_ARKITEKTUR,

    You are right about the camera tilt.
    We have to add this parameter to enable a complete camera orientation control.

    As for sending Grasshopper camera animations to Rhino:
    - Setup your camera animation path in GH
    - Use the V-Ray Timeline to control the animation progress
    - Connect the Timeline to the Renderer as well
    - Create a V-Ray Render in Project component and feed the Renderer/Scene data as an input
    - Right click on the Render in Project component and select Export Camera Animation - this will send the camera movement animation to V-Ray in Rhino as if you've recorded it with the native rhino animation tools
    - In the Asset Editor enable Animation rendering and specify the frame range you want to render
    - Do a regular Production Render

    Grasshopper object animations can't currently be send to the Rhino project.
    This is on the other hand, something we'll enable with the next update.

    Regards,
    Konstantin

    Comment


    • #3
      Thanks!

      I think I tried that method for setting up animations, but it only works with your camera component, not a custom c# script, right?

      As I'm only animating the camera I found a workaround, for this particular project:
      A C# script moves the camera (including tilt ) and saves named views for all frames.
      Then render with batch-render. This seems pretty robust, with status bar and all!

      I think my main request would still be that triggering a render happens on an input and not through right clicking and hitting render.
      This would enable me/others to implement missing features while your components are in development and fringe cases that is not practical to include for everyone.

      As for including the rhino scene in the render, does that need a separate component? Couldn't just be a toggle in the main component?

      One more question. In my quest to solve the camera-animation I pursued a few different solutions. One included triggering a rendering with the rhino command (from a GH C# component).
      This stopped when I could not find a 'render finished'-event (or 'VFB idle' or similar) that I could subscribe to. Does such exist from within a C# component in GH?

      All the best,
      Joakim

      Comment


      • #4
        Hi Joakim,

        You can trigger a render from a script in GH.
        You only need to write 5 lines of code:

        Code:
        //..
          using System.Linq.
        //..
        
          private void RunScript(object x, object y, ref object A)
          {
            Guid vrayRendererId = new Guid("D55BD53D-A509-4379-A684-B322E601DFE3");
            var renderer = Grasshopper.Instances.ActiveCanvas.Document.Objects.Where(o => o.ComponentGuid == vrayRendererId).FirstOrDefault();
            if (renderer != null)
              renderer.GetType().GetMethod("Render", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).Invoke(renderer, new object[] { false });
          }
        Here I get the First component of type "V-Ray Render", there might be more, then you need to consider your options.
        Then I just get the MethodInfo of the Render() function, which is public, and call it

        Comment


        • #5
          Thanks again! This opens up a lot of possibilities that I was not aware of, not only for V-Ray but other components as well.
          Is there a way of listing all the public properties and methods of GH components? (a little off topic, I know)
          Last edited by HOEN_ARKITEKTUR; 16-08-2019, 06:16 AM.

          Comment


          • #6
            Hi Joakim,

            as you can see I'm using reflection here, not a public API. This is rather a cheat.
            I'm intentionally altering an object state. This is not something you should do on daily basis, but only as an exception.
            The methods, even public, are not meant to be called from outside the implementation. Here I'm OK calling from an external script, because this is an event handler that responds to a menu command without side effects (I wrote that so I'm pretty confident)

            I'm merely giving you this snippet as a workaround for a situation where we blocked your workflow
            I should rather expose a more civilized way of invoking the renderer instead.

            Please be a responsible developer and don't misuse people's components, unless the author gives you a consent.

            Comment


            • #7
              Thanks. Warning received

              Comment

              Working...
              X