GhGL Discussion

I’m going to do my best to attempt to show how GhGL works today at 10 AM Pacific Time. I will also try and record it for others to view later.

Topic: Rhino/Grasshopper Social - GhGL
Time: Apr 8, 2020 10:00 AM Pacific Time (US and Canada)

Join Zoom Meeting

Meeting ID: 544 829 175

1 Like

Got zoombombed with that open invitation. I’m going to try again in a half an hour (12 Pacific time). Let me know if you would like to attend and I’ll send a private invite.

Hi @stevebaer,
Did Meeting ID change? When I try with “544 829 175” I get:


Yep, I had to shut it down. Got zoombombed pretty bad. I just finished and will post a link to the recording in a little but


It was really interesting!

Will those functions be available through a c# script/component?

Thanks for joining. Always hard the first time; I’ll get better at it :slight_smile:

I’m assuming you are referring to the functions like WorldToScreen. I could definitely make these available. They are already available through RhinoCommon in just a slightly less “wrapped up” style.

I meant the actual shader functionality.
To have a single component doing everything: manipulating geometries and having the component preview itself made from ghgl internally and parametrically.

(Maybe it was already accessible, but it’s the first time for me seeing what you did.)

The shader code has to be in GLSL specific syntax as that code is directly sent to the GPU for compilation and execution. I could make this code as some “preview” setting on a component, but that would require quite a bit of new code. For all of the experiments that I’ve done, it really feels cleanest to just turn the preview off for the upstream components.

Here’s a recording from the presentation today


Here’s a new video I just recorded on applying textures to meshes in GhGL


Can somebody explain in one sentence what ghgl is or where to find information about what it is other than how it works? :slight_smile:

Edit: Just found this
“GhGL is a set of OpenGL shader authoring components for Grasshopper that display shader results in Rhino viewports with inputs defined by Grasshopper data.”
Looks cool!

GhGL is a grasshopper component that allows customized display in Rhino viewports.

That’s about as terse as I can get. These components are basically “scripting components” that provide support for writing OpenGL shader programs with GLSL shading language. We use these components to debug and improve the OpenGL display in Rhino. The components can be used to perform all sorts of drawing effects and are fast since they are running programs on your GPU.

Thanks for that, after seeing your Video and the Toon Shader from @jho

I did try to implement this shader

I had some difficulties with the vectors (still some error on vectors …), not sure I understand well how to transfer data and if it mandatory between the tabs (vertex, …).


Here’s a very basic toon shader sample.

It looks like your shader is attempting to draw some silhouettes by comparing the normal vector of a triangle with the camera direction. I’ll see if I can add to the sample above to include this effect.

1 Like

I’ve uploaded a file for your reference.


:slight_smile: Looks like you beat me to it. Thanks @jho

1 Like

On latest wip + GhGL v7.0.3 as in the video, I have point size not working correctly.
With rhino antialias off dots are showed as a single pixel.
With antialias on (any “x”) dots are shower as circles with 64pixel diameter.
I cannot change the pixel size with the built-in right-click menu.

Any ideas of what is going on?

Can you share your definition?

Sure, but it is actually an untouched “GL Shader” component: (12.5 KB)
Antialias off (small black dots):
2020-04-13 16_57_42-Window
Antialias on:
2020-04-13 16_57_19-Window

That is clean GLSL code. My initial guess is that this could be a driver bug. If you can update your driver, you might want to try it and see if it makes a difference. One or two pixel points are common in OpenGL, but other sizes are often implemented using other techniques.

The points that we draw in Rhino use a different technique of drawing through the use of a geometry shader to expand a point into a screen aligned quad. I’ll be covering that technique in a discussion on billboards this week on Wednesday.