[Plugin] RayTrace & RaySpray

[Plugin] RayTrace & RaySpray

Postby TIG » Wed Mar 24, 2010 1:29 pm

This is in response to recent requests for an early-stage acoustic reflected-ray design tool...
[works for light and balls too]
DOWNLOAD THIS FILE
raytrace.rb


(c) TIG 2010

raytrace.rb

Place the script in the Plugins Folder.

Usage:
'RayTrace'
Type raytrace in the Ruby Console or
pick 'RayTrace' off the Plugins Menu.
Follow the prompts:
Pick the Start Point of the 'Ray Trace'.
A magenta guide-line shows the possible 'Ray' path.
Pick the End point of the 'Ray' on any face.
A 'Ray' is drawn between the two picked points as a guide-line with
guide-points.
The reflected 'Ray' is then drawn - it extends until it hits a
face. If it hits something then a guide-point is drawn,
otherwise the reflected 'Ray' guide-line is drawn infinitely long.
If the 'Ray' has hit a face then a dialog asks if you want to
'Bounce the Ray': answer Yes to make the next part of the 'Ray'
or No to stop this 'Ray'.
If these is no hit then that 'Ray' set automatically ends.
The tool now repeats: to stop select another tool or press <Esc>.
The set of 'Rays' is grouped for ease of identification or later
deletion.
Clear Guide-points and Lines using third party-scripts or use
Edit > Delete Guides...

'RaySpray'
Type rayspray in the Ruby Console or
pick 'RaySpray' off the Plugins Menu.
Follow the prompts:
Pick the start point of the 'Ray Spray'.
A dialog asks if you want to constrain the spray in X/Y/Z-planes
or 3D.
It also asks for the angle of separation of each of the spray's
rays - default is 30 degrees - closely angled rays take more time
to do - 3D rays are obviously more intensive.
The 'Ray' guide-lines and points are grouped, as in 'RayTrace' .
There is no 'bounce' option with this tool, but once it the
'Ray Spray' has been made a 'Ray Trace' can be done on any
desired Ray's points, with bounces as required...
After one use the tool does NOT repeat, it needs reactivating...

Donations:
Are welcome [by PayPal], please use 'TIGdonations.htm' in the
../Plugins/TIGtools/ folder - or PM TIG for details...

Version:
1.0 20100324 First issue.
1.1 20100325 Possible Bounces added. Ray Spray added.
1.2 20100326 Bouncings now stops on 'No' ! Inferencing improved.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Raytrace

Postby watkins » Wed Mar 24, 2010 2:36 pm

Dear TIG,

Tell me, do you ever sleep?

Bob
0

watkins 
 

Re: [Plugin] Raytrace

Postby pilou » Wed Mar 24, 2010 3:26 pm

Does this accoustic ray takes the same way than the way for a ray tracer "light"?
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Raytrace

Postby TIG » Wed Mar 24, 2010 4:15 pm

watkins wrote:Dear TIG,
Tell me, do you ever sleep?
Bob

He asked; it seemed simple enough to do, so I did it... :D
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Raytrace

Postby TIG » Wed Mar 24, 2010 4:16 pm

Pilou wrote:Does this accoustic ray takes the same way than the way for a ray tracer "light"?

The 'reflected angle' of a 'ray' off a face works the same for sound, light, balls etc etc...
So get working on your billiards game... ;)
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Raytrace

Postby TIG » Wed Mar 24, 2010 4:18 pm

It only does one iteration [bounce] as that was what was asked for - if multiple 'bounces' are required it is quite possible to do it... although in a closed box shape it could go on forever !!!
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Raytrace

Postby minguinhirigue » Thu Mar 25, 2010 8:35 am

This is really good ! Thanks. :ecstatic:

It should be greater to have a dialog box with :
Iteration : number of reflexion of ray (bypass for infinite ray, and warning for more than 10 ?).
Number of ray : draw N initial rays from the focal point (warning for more than 30 ?).
Planar : option to constraint reflexions in a plan for early analysis of acoustic reflexion in the section of any room.

I guess I would be to busy to work on this, like dozen of other script that are waiting...

By the way, good job TIG, thanks.
0

minguinhirigue 
 

Re: [Plugin] RayTrace & RaySpray

Postby TIG » Thu Mar 25, 2010 12:59 pm

Here's v1.1 viewtopic.php?p=235227#p235227

It now has RayTrace AND RaySpray

RayTrace traces the picked ray from a start and incident point - it then allows 'bounces' to be made if there is a 'hit'...

RaySpray sprays rays out from a picked point, constrained in X/Y/Z-panes or full 3D with a desired angle of separation; there is only one reflection - no 'bounces', but RayTrace can be used over an earlier sprayed ray to 'bounce' individual ray-paths more if required...

All guide-lines/points are now grouped...
:ugeek:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] RayTrace & RaySpray

Postby mitcorb » Thu Mar 25, 2010 3:12 pm

You didn't answer the sleep question :lol:
0
I take the slow, deliberate approach in my aimless wandering.
User avatar
mitcorb 
Top SketchUcator
 

Re: [Plugin] RayTrace & RaySpray

Postby solo » Thu Mar 25, 2010 3:13 pm

You didn't answer the sleep question


Because he is sleeping? :mrgreen:
0
My site

I'm a social vegan, I avoid meet.
User avatar
solo 
Global Moderator
 

Re: [Plugin] RayTrace & RaySpray

Postby Khai » Thu Mar 25, 2010 3:22 pm

he's sleeping?
who let his Coffee IV run dry?
0

Khai 
 

Re: [Plugin] RayTrace & RaySpray

Postby mitcorb » Thu Mar 25, 2010 3:24 pm

ok while he's away, let's debate the bouncing forever question shhh ;)
0
I take the slow, deliberate approach in my aimless wandering.
User avatar
mitcorb 
Top SketchUcator
 

Re: [Plugin] RayTrace & RaySpray

Postby TIG » Thu Mar 25, 2010 6:00 pm

I'm back ! ;)
Actually I was plumbing in a second bathroom ! :?:

The "bouncing forever problem" is avoided because you choose to do each additional bounce after the last reflection - unless when you are asked if you want a 'bounce' you are daft enough to keep pressing Y[es] a zillion times it will stop at he first N[o]... You only get a 'bounce' dialog Y/N if the ray has hit something after the last reflection anyway, otherwise it stops...

Any other ideas or even suggested uses welcome - I feel I've invented something that is looking for a use - e.g. Pilou's 'billiards' seems an outsider ???

:thumb: :ugeek:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Raytrace

Postby AdamB » Thu Mar 25, 2010 8:59 pm

Pilou wrote:Does this accoustic ray takes the same way than the way for a ray tracer "light"?


"Not really" is the answer. I looked into this when we were trying to design a new 3d audio system in a previous life.

So for light (MHz), the frequency is so high that diffraction / diffusion effects can be ignored. It moves in straight lines.

But for sounds (kHz) , edges/corners/gaps have huge effects. Hence you can hear somebody speaking when they're around a corner!

Moreover, the lower frequencies are going to spread around corners more than the higher frequencies components so what you hear will be different too. And just to make it even more complex, the substance of the building transmits sound - so if you're in the next room and listening to something, you may get high frequencies components coming out the door of one room into the door of the other while the low frequencies come through the wall.
0
Developer of LightUp Click for website
User avatar
AdamB 
LightUp Support
LightUp Support
 

Re: [Plugin] RayTrace & RaySpray

Postby pilou » Thu Mar 25, 2010 10:12 pm

Thx for precisions! :enlight:
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] RayTrace & RaySpray

Postby honoluludesktop » Thu Mar 25, 2010 11:52 pm

AdamB, That's right about sound, then again (I am guessing that) if you have a mirror, with a thick exposed glass edge, with refraction, the behavior of light too is not that simple.

Which brings to mind, the question of how much accuracy do we need? In one of my renderings, the biggest component is a pair of ladies shoes that I downloaded from Google. Nice touch in the rendering, but it was bigger then the architectural model itself. The other day someone posted a simple looking room with lots of computers, (maybe 50+) complaining about the size of his model. I'll bet that the keyboard keys were individually built with graphics, molded corners, etc. What did the renderer have to do to get that image out?

We need a program that will simplify mesh models of small things that are drawn with great care and accuracy. But guess that is off post:-), sorry.
0
User avatar
honoluludesktop 
In Remembrance
 

Re: [Plugin] RayTrace & RaySpray

Postby erikbernhart » Fri Mar 26, 2010 10:11 am

wow, good work TIG,
I was just wondering this morning if there is such a tool available in sketchup.
and it exists, created just one day ago!!.what's the coincidense
great tool for me as a student, who doesnt have such expensive software to do raytrace/spray modelling.
0

erikbernhart 
 

Re: [Plugin] RayTrace & RaySpray

Postby AdamB » Fri Mar 26, 2010 10:25 am

honoluludesktop wrote:AdamB, That's right about sound, then again (I am guessing that) if you have a mirror, with a thick exposed glass edge, with refraction, the behavior of light too is not that simple.


But thats the point. The wavelength of visible light is so small compared to the thickness of the mirror, the interference between the bounce from the back of the mirror and front is effectively zero.

Unless you have very thin mirrors! :-)

[OT: Few years back I lifted the hinged door off an old french clothes cupboard to do something. The door had a mirror on it and must have weighed 50-60Kg. I staggered over to the bed and dropped it on the bedcovers and noticed the mirror had tiny flecks of mercury oozing out. The whole mirror was constructed by sandwiching mercury between glass!]
0
Developer of LightUp Click for website
User avatar
AdamB 
LightUp Support
LightUp Support
 

Re: [Plugin] RayTrace & RaySpray

Postby AdamB » Fri Mar 26, 2010 10:34 am

honoluludesktop wrote:We need a program that will simplify mesh models of small things that are drawn with great care and accuracy. But guess that is off post:-), sorry.


For many many years people have struggled with this "level-of-detail" issue. There has been some great work done by Hugues Hoppe etc but ultimately its difficult to get satisfactory results because the shapes have "meaning" to us that the computer program doing the reduction simply don't understand.

In some sense, we've got this all back to front. We should be describing our models with the minimum information and then refine that description to get more details. Certainly when you get to the point of having sub-pixel polygons, you have to question whether this is such a great representation.
0
Developer of LightUp Click for website
User avatar
AdamB 
LightUp Support
LightUp Support
 

Re: [Plugin] RayTrace & RaySpray

Postby TIG » Fri Mar 26, 2010 11:02 am

This RayTrace tool etc IS a very basic tool - typically it's for use in placing elements, like acoustic reflectors in ceiling etc, at something like the correct angle to get the reflected sound to the right places.
You'd only use it in your early volumetric designs - once the design develop I'm sure specialist acoustic design tools will be used to fine-tune the details... :?:
1
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] RayTrace & RaySpray

Postby thomthom » Fri Mar 26, 2010 11:29 am

AdamB wrote:In some sense, we've got this all back to front. We should be describing our models with the minimum information and then refine that description to get more details. Certainly when you get to the point of having sub-pixel polygons, you have to question whether this is such a great representation.


hmm... a plugins to analyse the model from the current viewport and highlight the ones with many sub-pixel polygons... or is there one out there already?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] RayTrace & RaySpray

Postby Ken » Fri Mar 26, 2010 1:12 pm

OK, I can visualize it now, the TV detective pulls out his laptop, fires up Sketchup and the ray trace plugin, and determine the bullets fight path, and solves another crime, all thanks to TIG and his plugin.

Ken
0
Fight like your the third monkey on Noah's Ark gangway.
User avatar
Ken 
Premium Member
Premium Member
 

Re: [Plugin] RayTrace & RaySpray

Postby honoluludesktop » Fri Mar 26, 2010 7:39 pm

AdamB wrote:But thats the point. The wavelength of visible light is so small compared to the thickness of the mirror, the interference between the bounce from the back of the mirror and front is effectively zero.

Unless you have very thin mirrors! :-)


Sounds like I got it backwards :-)

How about a render program that lets the user adjust select components (like keyboards in a large office) to reduce render times?
0
User avatar
honoluludesktop 
In Remembrance
 

Re: [Plugin] RayTrace & RaySpray

Postby Didier Bur » Fri Mar 26, 2010 9:23 pm

Cool plugin TIG !
I'll surely use it to explain to my students how light bounces when hiting objects and so on 8-)
I cannot see the usual red-green-black-blue-cyan colored dots when snapping points for postionning the start and end points. Is this normal ?
0
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: [Plugin] RayTrace & RaySpray

Postby TIG » Fri Mar 26, 2010 9:27 pm

Didier Bur wrote:Cool plugin TIG !
I'll surely use it to explain to my students how light bounces when hitting objects and so on 8-)
I cannot see the usual red-green-black-blue-cyan colored dots when snapping points for postioning the start and end points. Is this normal ?

I have probably not set 'inferencing' properly in the tool code !
I did it in a rush... :roll:
I'll look at it..........
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] RayTrace & RaySpray

Postby Didier Bur » Fri Mar 26, 2010 9:37 pm

I give you 1 hour to correct the problem. And please DON'T GO TO SLEEP. HEAR ME ? :roflmao:
0
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: [Plugin] RayTrace & RaySpray

Postby Ken » Fri Mar 26, 2010 10:17 pm

TIG

Thanks for a fun plugin. I know other will need this, and I know sometime in the future I will be able to find a good use for this plugin.

On a side note, my version just keep bouncing the ole rays until it doesn't hit anything. I was playing with it in a box. Selecting the "NO" bottom does not stop the rays.

Just passing this on. If I am the only one with this problem, I can live with it.

Again, thanks for plugin. Can't wait until I find some usual project for this plugin.

Ken
0
Fight like your the third monkey on Noah's Ark gangway.
User avatar
Ken 
Premium Member
Premium Member
 

Re: [Plugin] RayTrace & RaySpray

Postby TIG » Sat Mar 27, 2010 12:15 am

Here's v1.2 viewtopic.php?p=235227#p235227
The bouncing now stops on 'No' - stupid typo :roll:
Inferencing improved.
[Sorry it took so long - but I do have to eat etc... ;) ]
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] RayTrace & RaySpray

Postby hebeijianke » Mon Mar 29, 2010 2:14 pm

TIG
thx
Can you make a icon for this plugin
0

hebeijianke 
 

Re: [Plugin] RayTrace & RaySpray

Postby lbjazz » Tue Mar 30, 2010 3:21 pm

Holy crap :berserk: - THANK YOU! I've been needing something like this for a while but don't have the time to learn enough Ruby to make it happen. You ROCK!
0

lbjazz 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: hanklin0 and 10 guests

Visit our sponsors: