360° Screenshots - Run component at end of solution [Solved]


I posted the same issue already in the old forum, but do not know atm. how to access the old posts. Otherwise I could have referred to it.
I made some components for creating 360 screenshots, that I would like to publish soon. However I am facing the issue that some preview components, if placed after the 360 components, are calculated after the generation of the 360 screenshots. You can see in the images below a version where objects are shown and the other, where they are missing. I have attached a simplified version of the GH file, explaining the issue in more detail.

Richard Schaffranek gave me a hint on how to solve the issue. I am trying to check inside the Cubemap component, if all other component except for the Cubemap and the SaveBMP have been solved. Otherwise it should wait until they are calculated and then generate the image. My approach does not seem to work though… I am not sure how @DavidRutten is doing it for the animation of sliders, but maybe that approach could help. Here is the little code that I am using:

 GH_Document ghdoc = this.GrasshopperDocument;
      if (ghdoc == null) { return; }
      foreach (object obj in ghdoc.Objects)
        if ((obj) is Grasshopper.Kernel.GH_Component)

          Grasshopper.Kernel.GH_Component GH_C = (Grasshopper.Kernel.GH_Component) obj;
          //exclude 360 components
          if (GH_C.NickName != "Cubemap" && GH_C.NickName != "SaveBMP")
            //check if components are still computing
            if (GH_C.Phase != GH_SolutionPhase.Computed && GH_C.Phase != GH_SolutionPhase.Failed && !GH_C.Locked)

              ghdoc.ScheduleSolution(10, ScheduleCallback);

///in the custom additional code section, i have added this:
  private void ScheduleCallback(GH_Document doc)

360-v1.3.gh (27.6 KB)

I managed it! Cubemap as well as SaveBMP need to be arranged to the top of the component stack. Would have preferred the schedulesolution option, but i guess the CustomPreview components also use it and if they are in the stack at the top, then their solution is scheduled afterwards.
So, soon you will see these components on Food4Rhino!

  ghdoc.ArrangeObjects(listGHC, GH_Arrange.MoveToFront);

Components helped me creating this Video (at 2:07):

Hi, realy nice video.

How did you render this in Grasshopper?


Hi Richard,
I captured the Video with a 360° camera and overlayed the Grasshopper frames on it and masked (mostly manually -.- …) overlapping parts .
In Grasshopper I projected the equirectangular video frames (saved them as jpgs) on a sphere, so I could easily see, how the Geometries would look like in the video (see pic. 1)
Then I saved the 360° frames via my components with green background and did the usual greenscreen stuff (see pic. 2) or I just multiplied a black and white image on the existing video (see pic. 3) and added some pixelisation and stereoscopic (cyan/red) effect in the compositioning software.
The animation of cars, scaling of buildings and fading of people all happened through Grasshopper. Have a look at the scene in pic. 4, it is like a movie set with flat facades, at least the trees :smiley:
Was quite some effort, but also fun! Actually blackmagix software now supports working with VR…I still used the normal video editing, therefore I wrote the text in Grasshopper… In my opinion, working with VR needs working in VR!

1 Like

But what did you use to render the Rhino bit, is it just Rhino display mode?

I have tried the same autromating cube maps rendering for Panowalkthrouhgs but I could only manage with neon renderer all other direct screen rendereres would produce different light / shading for the different sides of the cube.

Also what sizes did you manage to export, the Rhino Viewport is limited to my screensize…

Anything I missed.

Now I understand what you mean. As far as I remember it was enough to place a sun in the document! I am not sure though atm, if my settings still were a bit different. I used the rendered mode with green or black background. Materials had mostly same colour for emitting and diffuse channel or just did not have shadows at all.

short answer on how to capture bigger screen:

 Bitmap capture = view.CaptureToBitmap(new Size(width, height), false, false, false);
  capture .Dispose();
  //checkout encoders etc. for saving bitmap, if you want to set the quality yourself.

long answer for producing cubemap:

  int width = 3840;
  //[some code]
  //45° viewport angle
  Rhino.RhinoApp.RunScript("_-PerspectiveAngle " + 45, true);
  //width and height in 4:3 ratio
 width = width + width % 4;
  int height = (int) Math.Round((double) width / 4 * 3);
  Bitmap cubemap = new Bitmap(width, height);
  int w = (int) Math.Round((double) width / 4.0);
  int h = (int) Math.Round((double) height / 3.0);
 //[some more code]
 //then produce cubemap:
  using (var canvas = Graphics.FromImage(cubemap))
    Bitmap capture = view.CaptureToBitmap(new Size(w, h), false, false, false);
    canvas.DrawImage((Image) capture, 0, h, w, h);
    //then rotate view again and use capturetobitmap again and place bitmap on canvas.drawimage at the correct position, repeat for all sides of cube

Btw. Fusion 9 switching from Cubemap to Equi to whatever in milliseconds at 1:00min.: https://www.youtube.com/watch?v=jRjRqsmRKmY Probably using shader or as u described it in the old forum. Next time I would definitely use this software. Maybe I would try to get screens out of another engine like streaming from GH to Unity and getting nicer images. But haven’t tried it yet. Convenience of using Rhino viewport is just, that one can produce images faster with capturing view than rendering an image, but lacks nice graphics and video editing workflow.