First Experiments using Grasshopper for Rhino

Grasshopper for Rhino – A visual programming language/environment.

This is a blog post of notes made whilst using Grasshopper for the first time.

Circles and Triangles

Above: Solving for x²+y² = r² . Nodes used: I created two number sliders for variables – (Radius & Adjacent side), along with an expression evaluate node, square root node and vector node for XYZ.

Above: I created a Theta variable and plugged it into the Cosine(sideX) and Sine(sideY) functions, as degrees, and then into a Vector XYZ node. Math revision – SohCahToa

Above: Cos and Sin multiplied by radius.

Above: I created a variable for the radius of pivot circle and multiplied it *2 to find the center point distance of the orbiting circle. I input the arc variable as radians – rad(x). Note: Input for expressions = x

Above: I added a 2nd circle with the expression Acos(1/2) and added the Arc variable to it. Note that the corresponding angle is 60° .

img_0577-11.png

Unit Circle reference image above from: Inverse Trigonometric/ArcCos.

I added more circles.

rotateArchCircles04bAbove: By shift dragging connections we can connect multiple links and post-it note style lists help visualize inputs/outputs. We could also use the merge node.

Function Curves

Construct Domain node (DOM) – Start Value (-10) End Value (10) (= -10 to 10)

Range Node – Give domain (-10 to 10) and steps (creates even spacing for steps within the domain – for example 10 will give a list of  steps each at 1/10th the domain).graphsCreate2

Interesting use of expressions for curves – see this article. I input a variety of variables, as number sliders, to create these pretty patterns.interestingFunction02

Unit circle

2 π = 360 degrees. 1 π = 180 degrees. I created two expressions, (cos(x* π) and sin(x* π), as vectors x and y to simulate the unit circle. The range node automatically generates a 10 number list within a domain (D). When we set the domain to 2 (2 π) we get a complete rotation of our unit circle. It works the same way with a node tree instead of an expression.

unitCircExpress

unitCircle

unitCircNodes

Pappus Chain

First I set up a simple relationship between three circles. As the radius of one circle increases the other decreases respectively. The magnitude of each  vector also increases or decreases to offset the change in radius . All three circles remain tangent.papuisRing03c

03_papuisRing03

Next I wrote an expression to invert the top circle and tested it with some tangent lines.papuisRing04

03_papuisRing04

After a little bit of reading I found a number of ways to place the chain of circles. The most direct way is to calculate a three point circle from intersection points.

By extruding a number of tangent lines I was able to extract the necessary points using the curve|curve tool. Split nodes, set to integer 1, were needed to split the list generated when more then one intersection occurred.papusCain02

pappusChainIntersections

03_papuisRing01

Circle number 2 added. Interesting but not very practical.papChainN2

With one circle created there is enough information to generate an ellipse. Math Revision – x²/a² + y²/b² =1
papsCh008

More circles added.

pappusCh006

“Series” nodes iterate versions of the top circle with 2*radius for steps. Lines from each circles center point intersect with the ellipse.papusCain03There are a bunch of interesting articles about the Pappus Chain. It would be a lot of fun to dive in more deeply and explore the mathematics properly. It’s a very interesting subject.

Epic Circles – Numberphile

Pappus Chain – Wolfram – Math World

Arbelos

Steiner Chain

Wiki – Pappus Chain

Chain Reaction

Reuleaux Skyscraper

It seems that everyone who uses Grasshopper for Rhino builds a skyscraper first. So why not. I’ll try a simple mathematical shape – A Reuleaux Triangle. It’s an interesting enough shape.

“Rotation of a Reuleaux triangle within a square, showing also the curve traced by the center of the triangle”

Rotation_of_Reuleaux_triangle

See Wikipedia entry

A Reuleaux Triangle is a shape formed from the intersection of three circular disks, each having its center on the boundary of the other two.reuleaux_circle01c

Above:  Before and after trim using region difference nodes to extract the reuleax triangle shape.

Twisting Node tree tests

Series node with inputs to control the count (number of levels), the rotation of levels (in degrees), and the step size (size between levels).Untitled

More control added with rotation variables for rotating the the start and end of the building.Untitled2

After a little more reading, and watching some youtube tutorials, I created my first grasshopper building. Not very interesting but it doesn’t have to be. Its just for learning.reuleaux_circle01D2

The node tree can be visualized with a param Viewer node which can display the tree visually – see node tree image.SkyScraperNodeTree

Grasshopper creator, David Rutton, has a video about data trees here.datatree

Nodes of note for data manipulation/deconstruction:

DataManipdeconstructData

To be continued…

Recreation of the Learn Vray course shaders within Maya – (Instead of 3ds Max)

Studio max has many advantages over Maya for shader creation, especially when it comes to procedural texturing. The alternative for detailed procedural texturing in Maya is to use a plugin like Filter Forge for Photoshop that can generate large tileable textures. It’s a some what poor work around but people like Alex Alvarez use this method to create detailed terrains in Maya/Mental Ray – see HERE. Hopefully Maya will some have better procedurals that work with renders like Vray, Arnold and Redshift soon.

Another annoyance is that curves in Maya don’t have bezier handles but, by using splines, the same result as in max, can be achieved.

Below I have replicated shaders from the “Learn Vray” course. See 3ds Max versions HERE.

I’ve scripted them into a UI which has formed an ever growing library. They need a little tweaking but I will do that as I use them. This is what I love about Maya – MEL and Python scripting.

Here’s how some of them look on the Learn Vray course shader ball, cloth and Gargoyle.

Eco Work Room

Another learning exercise – this time a recreation of a room from Home Design Magazine by Catherine Whitting – an Eco Interior. I changed alot of details but kept the overall color scheme and basic furniture arrangement.

Modeled in Maya.
Rendered in Vray for Maya.

Final Render

Light Balance