Grasshopper Python access to render + channels?

Can we access rhino render channels through Grasshopper, or export an image silently, specifying the render channel(s) to be exported?

So I can get the guids of render channels:

import Rhino

ch_settings = Rhino.RhinoDoc.ActiveDoc.RenderSettings.RenderChannels.CustomList

# Check if there are enough items in the list to fetch
if len(ch_settings) >= 4:
    # Fetch items 0, 1, 2, and 3
    item0 = ch_settings[0]
    item1 = ch_settings[1]
    item2 = ch_settings[2]
    item3 = ch_settings[3]

print ch_settings
print item0
print item1
print item2
print item3

Rhino.RhinoDoc.ActiveDoc.RenderSettings.RenderChannels.BeginChange
Rhino.RhinoDoc.ActiveDoc.RenderSettings.RenderChannels.CustomList(item1, False)
Rhino.RhinoDoc.ActiveDoc.RenderSettings.RenderChannels.CustomList(item4, False)

Rhino.RhinoDoc.ActiveDoc.RenderSettings.CommitChanges()

i get info on the lists of channels:

Array[Guid]((<System.Guid object at 0x00000000000002B6 [0bf72376-691d-4074-8423-a8d1a3c5fdb8]>, <System.Guid object at 0x00000000000002B7 [453a9a1c-9307-4976-b282-4ead4d539879]>, <System.Guid object at 0x00000000000002B8 [788d1b1c-a928-40c0-bb93-f4aeb7fd3af4]>, <System.Guid object at 0x00000000000002B9 [b752ce0b-c219-4bdd-b134-26425e1c4331]>))

0bf72376-691d-4074-8423-a8d1a3c5fdb8
453a9a1c-9307-4976-b282-4ead4d539879
788d1b1c-a928-40c0-bb93-f4aeb7fd3af4
b752ce0b-c219-4bdd-b134-26425e1c4331

But I am getting this error:

Runtime error (ArgumentTypeException): Array[Guid] is not callable

Traceback:
line 21, in script

Anyone can help will be great

I am sure it wont let me, but ideally want to render with RGBA, Distance and Albedo turned off.

I will try to start another thread to see if anyone knows a way to export only the normal channel.

Create a new array of Guid and assign that to CustomList

Hello @nathanletwory
Some of this is already beyond my capabilities,

Not asking you to write it for me - perhaps this can be a feature request:

I am trying to automate some aspects of the render process. Ideally I would like to export the normal and depth channels of a rhino render silently.

I would be happy to have the render window pop up, but would still like those channels to save automatically.

In the render commandline options, there are not many choices. I am trying to use GHpython to:

  1. Set the render channels to custom, and check if normal and depth are on, and if not switch on.
  2. Start the render process (have a few diff gh py scripts that do this for me), but would be good to have an all in one.
  3. Save all channels automatically - most render engines provide this option.
  • I am able to render and save window, but it just saves the rgb.

Simpler option may be to set the environment map with a normal texture as per this thread:

  • but this wont give me a depth map.

With regards to the render channels, you should be able to set a new array containing the Guid values for the channels you want enabled.

I don’t think there is any way of scripting saving out the results of a render channel at the moment. At least I am not aware of any.

Ok, thanks, is it possible to add some command-line options to render, to help people use it in macros.,

From my point of view, these could be:

  • Width / height
  • Aspect ratio
  • Save with file path / name
  • Channels to save
  • Named Views / viewports to render (batch)

Hi @nathanletwory

How can I request to start, run, save, control render + options inc render Chanel output from Grasshopper? Is it possible to get this requested in as a feature in G2 / R8?

@DavidRutten