Sketchup Light Ray Reflection Simulator Plugin

Subscribe to my Feed!

On this page you will find a plugin for Sketchup which will allow you to simulate how light rays reflect from a surface.

The Sketchup Light Ray Reflection Simulator Plugin is easy to use. All you have to do is just draw a surface and a line to represent a ray of light, select them both, and run the plugin.

You can even do multiple lines, surfaces, and reflections all at once like in the picture below.

img2A

I wrote this plugin to experiment with different types of solar collection designs, but I’m sure that it can be used for other things as well.

If you find this plugin useful, consider making a donation to help further both its development and also the development of other plugins.

Download

Click the link to download the plugin LightRayReflectionSim.zip

Options

If you go to Plugins >> Light Ray Reflection Simulator >> Options, the window shown in the picture below will pop up.

img2E

These options do the following:

Number or Reflections?

The Number of Reflections option allows you to set the maximum number of reflections each line will complete.

The picture below shows a line representing a ray of light on the left set up so that it should bounce between the face on the top and on the bottom.

img41

This picture shows the model after the simulation was run. Since the simulation was set to only reflect three times, only three reflection were drawn by the plugin even though it could have done more.

img43

Scale of Last Ray?

The Scale of Last Ray option will tell the plugin to draw either longer or shorter rays. There is not particular unit of measurement here. Basically, bigger numbers create bigger rays and smaller numbers create smaller rays.

It may take some experimenting to get the perfect scale for your model depending on how big the objects are in it.

img4D img4B

Draw First Ray?

The Draw First Ray option lets you decide whether or not to draw the first ray. Sometimes, drawing the first ray makes it harder to see how the reflected lines behave. The parabola example below is an example of this.

Example

In the picture below, notice both that there is a model of a parabola and that several short lines have been oriented above it. Each of these short lines represents a ray of light.

Note: When drawing your own lines, make sure they don’t touch either the surface they are supposed to reflect from or each other. If they do touch, they will be ignored.

img28

Here, the model has been selected and so have the lines representing the rays of light. Any face or line not selected will be ignored when the plugin runs.

img29

After the desired objects have been selected, go to Plugins >> Light Ray Reflection Simulator >> Run Light Ray Reflection Simulator to run the plugin.

Each line should now “reflect” from the surface as though it was a ray of light.

Note: In this example the option to draw the first ray was turned off to make it easier to see what’s going on.

img2A[4]

Since this was a model of a parabola, the lines converge to a point just as they would in the real world.

img2B

Also, since this model is only an approximation of a parabola, the rays don’t quite converge to a single point. They are, however, reasonably close.

img2C

Troubleshooting

Tip 1. If you try running a simulation and nothing happens, it could be that the edges/lines used to represent the light rays intercept the model’s edges instead of its faces. Try moving the “light rays” to be sure that they will intercept the faces when the simulation is run to fix the issue.

Tip 2. There is a known bug when creating multiple reflections which will cause part of the rays to “stick out” through the face they reflect from (Example below). To avoid it, use smaller numbers for the scale of the last ray.

img53

 

Subscribe to my Feed!

6 Responses to Sketchup Light Ray Reflection Simulator Plugin

  1. Venus says:

    Hi,

    This looks like a great program. Do you know why the .rb extension won’t open? Do you know if I need to download ruby or is sketchup sufficient to open this?

    Also, does your program work with three objects, such as light rays, a mirror, and a shape for the rays to scatter off after hitting the mirror?

    Thanks!

  2. Gabriel Miller says:

    Hi Venus,

    You don’t really open it to install it like you do with other programs. Basically, you just have to put the downloaded file in a place where Sketchup can find it to run it.

    The .rb file should be put in…

    C:\Program Files\Google\Google SketchUp 7\Plugins. (Windows)
    or (on a Mac computer)
    Macintosh HD/Library/Application Support/Google SketchUp 7/SketchUp/ (Mac)

    A quick Google search of “how to install sketchup plugins” well turn up several tutorials on the subject too.

    The program will indeed work with three objects. Make sure they aren’t grouped though. You’ll see after you get the chance to play around with it some, but basically every face you select is seen as a mirror.

    Hope that helps!
    Gabriel

  3. Lorenzo says:

    Great!!!
    I’m planning a solar oven for my holidays and your plugin works very well! Maybe the planet will save some CO2 thanks to your job!

  4. Nick F. says:

    Thanks for the great plugin. I am trying to use it with Google Sketchup 8, but it doesn’t seem to work (nothing really happens). Do you know if it is supported in Sketchup 7? Do you have a simple sketchup test file I can try?

    Thanks again.

    • Gabriel Miller says:

      Hi Nick,

      I just downloaded Sketchup 8, and the plugin seems to be working fine for me. I am on a Mac, but I doubt that would make a difference.

      What do you mean by “nothing really happens”. Is it nothing as in absolutely nothing or nothing as in nothing useful.

      It should be pretty straight forward to use, just draw a face and orient a line so that it is not touching the face, but would pass through that face if it were longer. Then just select the line and face and run the plugin and it should reflect.

      Also, make sure that the objects aren’t grouped.

      If you go to Window>>Ruby Console, you can check to see if you are getting any errors when the plugin is run. Ideally though, you shouldn’t get any output, but, if you do, either post them here or email them to me if you don’t mind.

      Thanks,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">