algorithmic modeling for Rhino



UPDATE: Sonic components are now part of Mosquito:



-Surface/Target Ray (reflect)

Sonic is a Grasshopper plugin that allows you to cast multiple rays, calculate reflections(bounces), calculate flow paths down a sloped surface. (eg. water runoff) Plus Added Math components.

Location: - South Africa - New York
Members: 86
Latest Activity: Sep 20, 2023


Rays video LINK:

Flow video LINK:


Sonic is a Grasshopper plugin suite that currently contains the following components:

UPDATE : New Refraction component!!!! as requested :)   and a fix for TargetRays when rays reflect several times off a single surface/object.


Refract: A plugin that works in a similar mannar to the Reflection component (TargetRays) except it calculates refraction rays. Requires that you specify a refraction index for the medium which the ray is passing from and into. See the description of this component below.

SquareRoot: An optimized Square Root function multiple times faster than the default Square Root Component (based on Math.Sqrt I presume) with a slight trade off in rounding numbers.

Flow: Calculates the flow of lines via the path of least resistance down a sloped surface.(eg. water runoff)

TargetRays + SurfaceRays: Both plugins are used to cast and calculate surface reflections rays.

We hope to develop this into a larger suite of components, but for now its contains three components.

The plugin suite  comes with many GH Example files.......


We hope to develop this into a larger suite of components, but for now its contains three components. The plugin suite  comes with many GH Example files…….




There is a tradeoff in accuracy, but that should not matter, given the speed.

The Algorithm


The binary Algorithm used in this component stems from Gaming and Graphic development back in the 1990′s, effectively calculating the inverse square root. It also makes use of Newton’s method of finding roots. I have also made use of some scary looking bitwise manipulation.




Surface: Plugin your surface that you wish to use for flow testing.

Points: Plugin your points that you wish to use for each stream, note that these points only have to be near the top of the surface , check examples .

Res: The resolution of the curve output. The low the value to more rigid the curve. Try to keep this fairly low.

Calc: Number of calculations for each stream. This input and ‘Res’ work together, if you raise ‘Res’ value then you need to increase Calc. Calc can also be used to animate the flows.

pLine: Use a ‘boolean toggle’ to choose whether the output ‘Curves’ are PolyLines. If left ‘False’ the output will be Interpolated Curves.





Main Features Include:


Multiple Surface Calculations ,Occlusion testing , Automated output of Normals, UVs , Vectors and more in ordered Data Tree Branches and Paths.



(NOTE: All outputs are demonstrated in the “OUTPut example” files included with the download.)

The outputs are the same for both plugins and are as follows:

Points: Exports a list of points for each ray, each ray has its own Path in the DataTree.

Vectors: Exports each vector for each of the above bounce 'Points', lists are ordered the same as the Points ouput.

Normals (UNDER WORK): Exports the normals for each reflection point for each surface supplied.

UVs: The respective UVs for the above list entries in case you would like to evaluate the surfaces, you will need to use some culling logic here.

Srfs: Outputs the input surfaces in a relative order to the above lists. excluding surfaces not involved in the process.

SrfUvs: This list order matches the "Srfs" output. Use this with the "Srfs" output to evaluate the surface bounce points.

SrfInd: This is an odd one, but it contains the indexes for the first 4 outputs with regards to surfaces in the "Srfs" Output. ( I find it useful)

SrfCull: This is used to cull out the first 4 output values so that the output is relative to each surface in "Srfs".

Curves : Outputs the bounce path for each ray as Polylines.


Calculates the refraction of rays through mutliple surfaces.


  • SourcePts: The start of a ray.
  • TargetPts: The end point of a ray.
  • Surfaces: The surface through which the rays will be refracted.
  • Ni: The Refraction Index of the first medium the ray starts in i.e. Air
  • Nr: The Refraction Index of the medium the ray is passing into i.e. Water
  • Solid: Toggling this will treat the space between any two surfaces as the same medium. Check example files included in the download for more info.

Refraction Indices:

I have included a list of generic Refraction Indices in the Grasshopper definition.

Enjoy the Plugin,

Carson Smuts


Rays video LINK:

Flow video LINK:




Discussion Forum

Refraction through multiple surfaces

Hi, I'm trying to simulate refraction of a single ray through 10 solid surfaces, each with a gradient refraction index between 1.00 and 1.01.How would I set this up?Continue

Started by Richard Aubin May 25, 2018.

The trouble problem of Target rays component 4 Replies

when the input of source points collect more than one point, the warning will show "1. Solution exception:Index was out of range. Must be non-negative and less than the size of the…Continue

Started by Joyce Ho. Last reply by Joyce Ho Jul 4, 2015.

Sonic Component updates 13 Replies

Sonic update 0.1.3b …Continue

Started by Carson Smuts. Last reply by Joyce Ho Apr 10, 2015.

Data Structure Preservation 3 Replies

Sorry, one more request! This just shows how much I want to use this plugin! I've been finding it difficult to use the output from the Reflection component when I have many source points because…Continue

Tags: list, management, reflection, structure, data

Started by Trygve Wastvedt. Last reply by Carson Smuts Apr 12, 2014.

Comment Wall


You need to be a member of Sonic to add comments!

Comment by Joyce Ho on July 2, 2015 at 1:32am

i discover the problem of the input of source points inside the target ray component while connecting with 12 points.
the warning shows that 

"1. Solution exception:Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"

if the source points more than 1, how to solve this problem?

Comment by Joyce Ho on April 3, 2015 at 9:35am

thank you

Comment by Carson Smuts on April 3, 2015 at 7:55am

Try now, the site was down for maintenance in the last 24 hours

Comment by Carson Smuts on September 28, 2014 at 4:25pm


This can happen on some window systems. The solution is to move the Newtonsoft.Json.dll file from the grasshopper components folder and put it inside the same directory as your Rhino.exe file.  Restart Rhino and Grasshopper and it should then work.
Comment by JAEHWA LEE on September 28, 2014 at 1:51pm

I have a problem with using Mosquito plug-in. And for reference, I tried to select "Multiple Data" as well. I got Mosquito 0.3. Thank you

Comment by Carson Smuts on February 19, 2014 at 7:30am

Norbert: could you be more specific? what do you mean by "noise map"? could you post an image or link?

Comment by Norbert Jundt on February 19, 2014 at 3:01am


is there a way to use sonic reflection to create a noise map?

many thanks,

Comment by Lisa Martinez on February 5, 2014 at 3:53pm

that's perfect, exactly what I was trying to do! is there a way to physically calculate supposed water runoff? I had extracted data from the endpoints of each curve and input those values into a panel, but all I understand it to be is location coordinates

Comment by Carson Smuts on February 5, 2014 at 3:38pm

Lisa: here is a quick example of how I would go about doing this. The plugin requires a continuous single surface.... so , I modeled the terrain and the buildings and then used rhinos "Drape" command in order to get out a single surface representing the terrain and buildings.

Then the plugin should work , taking into account both the terrain and buildings.


Comment by Carson Smuts on February 5, 2014 at 3:06pm

Hi Lisa, can you post an example file with some demo geometry and I will take a look.


Members (86)






  • Add Photos
  • View All


  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service