Skip to content

Sonderwoods/MantaRay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project MantaRay (GrasshopperRadianceLinuxConnector)

An educational tool to work directly with Radiance through Grasshopper. This allows you to utilize all the linux native Radiance commands including the GUI tools such as rvu, piping etc.

Presentation video

Please see the presentation video of the tool at the Radiance Workshop image


Components:

SSH Connect

  • Connects to a SSH. Can embed password in GH script (internalize) or will prompt on execution.
  • Will automatically run bash sudo service ssh start if it's not already running (will ask before so)
  • Will keep password even if you say recompute all. To set up a new selection set it to false and then true.

RadViewer

  • Super fast parsing of multiple rad files
  • Preview of random colors (Todo: Match color of radiance material)
  • Todo: Legend for the colors
  • Todo (Optional): Clickable objects to get modifiers

Mesh2obj (and obj2rad)

  • Runs in parallel and is fast
  • Orients normals (vertice order in radiance) to match rhino mesh normals

Setup Globals (and Apply Globals)

  • A place to set your variables and reuse them, ie project folder etc.
  • Can also be used for local replacements in the ssh command
  • Only one Setup Globals component can be placed at the canvas at the same time (otherwise see screenshot)

Execute Async

  • The component that does the magic.
  • Reuses outputs and saves them on your canvas. This means that when reopening grasshopper, you don't have to run all commands again if the temporary files are still there.
  • Runs asyncronously, which means it does not block the grasshopper UI while it's running.
  • Two components next to each other depending on the same inputs will both run in parallel and first trigger the downstream components when both are finished (use the RAN output as it becomes true when finished).
  • To avoid this behavior, you can graft several inputs into the same component instead.
  • Access to ImageMagick and the meta functions in linux only Radiance

Async SSH Components in place (based on the speckle async)


CreateView

  • Input a perspective named view from Rhino or use the active viewport
  • Outputs the data for a viewfile. Can be echoed into a .vf file.
  • Previews your camera in Rhino viewport in red. Green if the component is selected.

ManPages


Disclaimer:

This is a personal project that I wrote during my paternity leave and it comes with absolutely no warranties. I was reading up on radiance and found the need for a lightweight connection from grasshopper without all the extra jazz from current workflows.

Todo:

Check out the issues on my todo list here.


Preparations

Setup Windows Subsystem Linux (WSL) and radiance

(I'll see if I can make a youtube vid at some point)

  • Start enabling WSL and installing Radiance and XLaunch as per this link. Don't make your username too long and dont make your password too complex. Do not make the PW the same as your windows user.

    UPDATED - USE THIS GUIDE FOR XLAUNCH: https://mohamad-wael.medium.com/wsl-gui-applications-using-x11-4c6ec575f98b

    (Found it here https://discourse.radiance-online.org/t/linux-subsystem-on-windows-ubuntu/5009/11 )

  • Install CShell using

    $ sudo apt-get install csh
    
  • Install libqt5 (a GUI program for some of the radiance GUIs) using:

    $ sudo apt-get install libqt5gui5
    
  • Setup symbolic links to access your windows simulation folder in linux. (ie, making a shortcut to ~/simulation in linux to target your C:\users<username>\Simulation in windows)

    $ ln -s /mnt/c/Users/<username>/simulation ~/simulation
    
  • Now you can always find your simulations by typinc

    $ cd ~/simulation
    
  • I assume you installed Xlaunch as per the first tutorial. Now start it as described in the tutorial.

  • Make sure your linux is pointing towards the XLaunch display driver by adding it to the .bashrc file:

    $ sudo nano ~/.bashrc
    
  • This will open the bashrc file. Go to the end of the file and add these two lines. (I cant remember how to paste, so you'll type them manually):

    export LIBGL_ALWAYS_INDIRECT=1
    export DISPLAY=$(ip route list default | awk '{print $3}'):0
    
  • Get the meta files to work such as meta2tga and meta2tif: Download the auxiliary files from https://github.com/LBNL-ETA/Radiance/releases Place them in simulation folder on windows CHMOD the lib folder like below. This may allow everyone to change your lib folder! You should look into what is the default chmod setting for the lib folder.. I did overwrite mine, so I'm unsure. This will give us write access to our lib folder.

    $ sudo chmod 777 /usr/local/lib
    

    Then copy the meta files to the lib folder using:

    $ cp -R ~/simulation/meta /usr/local/lib/meta
    
  • Install ImageMagick. This will grant you access to mogrify and convert. See more in the Radiance Tutorial

    $ sudo apt update
    $ sudo apt install imagemagick
    

Setup SSH in linux and connect to it from Windows

  • Follow the tutorial on this link. However I didnt manage to get the disable password part to work. Confirm that it's working by starting PowerShell and type:

    ssh <mylinuxusername>@127.0.0.1
    

If it prompts you for your password you should be good!

Adding Intel Open Image Denoiser

Download the tar.gz here Place it somewhere on your linux machine, for instance in /usr/local/OpenImageDenoiser

$ sudo mkdir /usr/local/OpenImageDenoiser
$ sudo tar –xvzf /mnt/c/oidn-1.4.3.x86_64.linux.tar.gz –C /usr/local/OpenImageDenoiser

Move from /usr/OpenImageDenoiser/ to /usr/OpenImageDenoiser/oidn-1.4.3.x86_64.linux to /usr/OpenImageDenoiser:

  $ sudo mv -v /usr/local/OpenImageDenoiser/oidn-1.4.3.x86_64.linux/* /usr/local/OpenImageDenoiser

add to path:

  $ sudo nano ~/.bashrc

change the paths to include it. Add this line in the end:

  export PATH=/usr/local/OpenImageDenoiser/bin:$PATH

test that it works (takes 1-2 min to run):

  $ cd /usr/local/OpenImageDenoiser/bin/
  $ ./oidnTest

EDIT: I havent found a good implementation of above yet. Quick fix is to use their CLI locally on the windows computer https://github.com/DeclanRussell/IntelOIDenoiser