[Plugin] Raytracer

[Plugin] Raytracer

Postby thomthom » Wed Sep 01, 2010 7:51 pm

Overview
Collection of small snippets I made during my work on projects at the office. I just named it Raytracer as all the methods involved tracing rays around the model - mostly to detect the ground surface. These dropping methods do not stop on entities that are hidden or on hidden layers.

Bug Alert!
There is a bug in the first release of SketchUp 8 where the ray tracing is not working correctly when there is CPoint in the current context. Ensure you have updated SketchUp 8

Access
Plugins > Raytracer

Features
Drop CPoints
Drops the selected constructions points down onto the surface below.
DropCPoints.png


Drop CPoints (Trace)
Adds a construction point on the surface below the selected construction point and adds a construction line between them.
TraceCPoints.png


Drop Components
Drops the selected groups/components down onto the surface below by their axis origin.
DropComps.png


Drop Components by Bounds
Drops the selected groups/components down onto the surface below by the corners of the bounding box' bottom.
DropCompsByBounds.png


Drop Components by Geometry (WIP)
Work in progress.

Grow Components from CPoints
  1. Select a set of components.
  2. Activate the command.
  3. From the window that appear, enter a comma or pipe separated list of layers containing construction point
  4. When clicking OK, all construction points on the given layers will be traced down to the surface below and an random instance of the selected components will be inserted between the surface and the construction point.
GrowComponentsFromCPoints.png


Trace Ray Spray from CPoints
Shoots a user-determined number of rays in every direction from every CPoint in the selection. The rays that hits something will be traced by a CLine and CPoint, grouped.
TraceSprayRay.png


Rays Stops at Ground Plane
Check this item to make rays stop at the virtual ground plane in SketchUp.

Requirements
  • SketchUp 7 or newer - ( Other versions untested )
  • TT_Lib2 (2.1.0)

Download



Footprint
<Sketchup>/Plugins/
+-
tt_raytracer.rb

1
Last edited by thomthom on Thu Nov 28, 2013 11:19 pm, edited 1 time in total.
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] Raytracer (1.0.0) — 01 September 2010

Postby Frederik » Wed Sep 01, 2010 8:18 pm

Thanks a lot, Thomas...!!
Just tested it with SU8 and it seem to be working excellent...! :D
(I'll remember to drop a cookie soon... ;) )
0
User avatar
Frederik 
Thea Render Support
Thea Render Support
 

Re: [Plugin] Raytracer (1.0.0) — 01 September 2010

Postby EarthMover » Wed Sep 01, 2010 10:08 pm

Nice bro. You are on FIRE today!!! I look forward to when you get the drop by geometry working!
0
3D Artist at Clearstory 3D Imaging
Guide Tool at Winning With Sketchup
Content Creator at Skapeup
User avatar
EarthMover 
Premium Member
Premium Member
 

Re: [Plugin] Raytracer (1.0.0) — 01 September 2010

Postby thomthom » Wed Sep 01, 2010 10:15 pm

You and me both. That is turning out to be a brain twister.
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] Raytracer (1.0.0) — 01 September 2010

Postby Panga » Thu Sep 02, 2010 11:01 am

Thanks a lot Thomthom, exactly what I requested a month ago for evaluating covisibility on a terrain !!
0

Panga 
Premium Member
Premium Member
 

Re: [Plugin] Raytracer (1.0.0) — 01 September 2010

Postby olishea » Fri Sep 03, 2010 4:28 pm

can you post an example of how this works please? just couple of images will do......pretty please :enlight:
0
oli
User avatar
olishea 
Premium Member
Premium Member
 

Re: [Plugin] Raytracer (1.0.0) — 01 September 2010

Postby thomthom » Fri Sep 03, 2010 6:33 pm

olishea wrote:can you post an example of how this works please? just couple of images will do......pretty please :enlight:

Done.

I found a bug in my plugin - so you want to update it and TT_Lib2.

I also found there is a nasty bug in SU8 that cause bogus results in the ray-tracing. I'm looking into this one - trying to work out way to work around it.
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] Raytracer (1.0.1) — 03 September 2010

Postby thomthom » Sat Sep 04, 2010 7:06 pm

Found a workaround. Please update TT_Lib2 to version 2.1.1.
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] Raytracer (1.0.1) — 03 September 2010

Postby Panga » Mon Sep 06, 2010 4:32 pm

Thomthom,

Thanks again for this plugin, but can I suggest you another function for this script. I need to make a raytrace from on point in every direction in order to see where rays intersect a terrain for example. I know that could generates a lot of rays and calculation, but It would be nice to have this function with maybe an option where we can choose the number of rays like : 1 to 10 rays / 10 o 100 rays / 100 to 1 000 rays. If it's possible, the rays should be drawn as guidelines, and a guide point could be automatically drawn on each intersection with the rest of the model.

I don't know if you can do that...just and idea for my workflow that can be helpfull for others maybe.

Thanks.
0

Panga 
Premium Member
Premium Member
 

Re: [Plugin] Raytracer (1.0.1) — 03 September 2010

Postby thomthom » Mon Sep 06, 2010 4:37 pm

Panga wrote:I need to make a raytrace from on point in every direction

:shock:
I know that could generates a lot of rays and calculation, but It would be nice to have this function with maybe an option where we can choose the number of rays like : 1 to 10 rays / 10 o 100 rays / 100 to 1 000 rays.

I say, yes, it'd be a whole lot of rays. So, would it be like sub-dividing a sphere and shoot a ray for every segment?

Panga wrote:If it's possible, the rays should be drawn as guidelines, and a guide point could be automatically drawn on each intersection with the rest of the model.

YEs, can draw them a guidelines, yes. But how many points of origins are we talking about? There'd a huge amount of CLines. Would there be a limit to how far they reached? Would it be ok to draw only the rays that hit something?
Do the rays need to ignore other geometry other than the target group/component?
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] Raytracer (1.0.1) — 03 September 2010

Postby Panga » Mon Sep 06, 2010 4:49 pm

YEs, can draw them a guidelines, yes. But how many points of origins are we talking about?


For my specific usage, there's two possibilities and the first one of them could be already fanstastic:
1. From one point at time
2. From one complex object (component or group)

There'd a huge amount of CLines. Would there be a limit to how far they reached? Would it be ok to draw only the rays that hit something?
Do the rays need to ignore other geometry other than the target group/component?


Yes, Yes and Yes. In fact I only need to evaluate "covisibility". So I could select a point on my model (or a complex object) and the plugin draw a certain number of rays only where there's intersections with the model, or with a specific component/group if it's easier to implement/calculate.

So, would it be like sub-dividing a sphere and shoot a ray for every segment?


This could be a good solution with a sphere that surrounds the whole model.

Thanks for your answer.

Regards.
0

Panga 
Premium Member
Premium Member
 

Re: [Plugin] Raytracer (1.0.1) — 03 September 2010

Postby thomthom » Mon Sep 06, 2010 4:52 pm

Panga wrote:
So, would it be like sub-dividing a sphere and shoot a ray for every segment?


This could be a good solution with a sphere that surrounds the whole model.

I didn't mean to put an actual sphere in the model, just how one would determine which of the infinite possible directions the rays should be shot. What I meant by the sphere was they the ray's be evenly distributed based on how many rays one shoot.
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] Raytracer (1.0.1) — 03 September 2010

Postby Panga » Mon Sep 06, 2010 4:58 pm

I didn't mean to put an actual sphere in the model, just how one would determine which of the infinite possible directions the rays should be shot. What I meant by the sphere was they the ray's be evenly distributed based on how many rays one shoot.


Yes I understood you. And controlling the number of segments/faces of the "virtual sphere" could help to have more or less rays. Whatever you can do for that, thanks in advance.

EDIT : In fact, what could be really nice is a "sun" or a omnilight that I could place wherever I want in my SU model, and with shadows activated I could see the illuminated parts of my models and the dark ones...
0

Panga 
Premium Member
Premium Member
 

Re: [Plugin] Raytracer (1.0.1) — 03 September 2010

Postby thomthom » Mon Sep 06, 2010 5:02 pm

I'm writing this down in the todo list. Will see what I can do.
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] Raytracer (1.0.1) — 03 September 2010

Postby thomthom » Tue Sep 07, 2010 9:56 am

hmm.... I'm not quite sure how to calculate the rays to shoot. Been all too long since I've done math like this...
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] Raytracer (1.0.1) — 03 September 2010

Postby Panga » Tue Sep 07, 2010 5:26 pm

My knowledge in maths are very limited...so I'll not be able to help you on that. Anyway, thanks for giving it a try !! ;)
0

Panga 
Premium Member
Premium Member
 

Re: [Plugin] Raytracer (1.0.1) — 03 September 2010

Postby thomthom » Tue Sep 07, 2010 9:11 pm

Found a solution! :D
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] Raytracer (1.0.1) — 03 September 2010

Postby Panga » Wed Sep 08, 2010 9:03 am

I had no doubt about that !! ;)
0

Panga 
Premium Member
Premium Member
 

Re: [Plugin] Raytracer (1.0.1) — 03 September 2010

Postby thomthom » Wed Sep 08, 2010 9:06 am

When I say I I mean, someone smarter than me helped me out. ;)
1
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] Raytracer (1.0.1) — 03 September 2010

Postby Panga » Wed Sep 08, 2010 9:56 am

Whatever if someone helped you or not, you were the one looking for the solution...so you found it ! :P
0

Panga 
Premium Member
Premium Member
 

Re: [Plugin] Raytracer (1.0.1) — 03 September 2010

Postby artupato » Wed Sep 08, 2010 11:31 am

sir Thomthom,
thank you very much for this plugin. :fecstatic:
what a coincidence! This day I've been thinking of raytracing and what is its concept. I think I'll understand this once I use your plugin and of course read some notes about it. :D
0

artupato 
 

Re: [Plugin] Raytracer (1.0.1) — 03 September 2010

Postby thomthom » Wed Sep 08, 2010 2:06 pm

grrrr.... SU8 has even more troublesome bug with the raytest method. I'm struggling to find a workaround.
I got the Spray Ray working in SU7 - but SU8 is being a PITA.
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] Raytracer (1.1.0) — 08 September 2010

Postby thomthom » Wed Sep 08, 2010 4:50 pm

Version 1.1.0
  • Requires TT_Lib2 (v2.3.0)
  • Trace Spray Ray.
  • Bugfixes.

Note: SU8 does not process rays properly and the results are not reliable!
I've been unable to work out a successful workaround. :(
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] Raytracer (1.1.0) — 08 September 2010

Postby thomthom » Wed Sep 08, 2010 4:53 pm

Kind-of like a cob-web... if the CLines was replaced with catenary curves...

cobweb.png



Wiki uses cob-webs as an example for catenary curves http://en.wikipedia.org/wiki/Catenary

I have no idea what the usage would be, other than for Halloween... but... cool...
1
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] Raytracer (1.1.0) — 08 September 2010

Postby Panga » Wed Sep 08, 2010 8:05 pm

Thanks Thomthom, I'll try it. Hope you can find a way to make it work under SU8 later.

EDIT :

Hi Thomthom,

I made a Test under SU8, and it Works pretty well. Until now, I test it with a max of 10 000 rays, and it takes about 15 seconds to calculate, so It's pretty fast. The only thing is it seems that some directions are ignored by rays, see on the picture below :

Test-raytracer.png


Whatever, It's already a really good tool for me. I'm thinking of other options, but I'll do some tests before talking about...See u and thanks again.
0

Panga 
Premium Member
Premium Member
 

Re: [Plugin] Raytracer (1.1.0) — 08 September 2010

Postby pilou » Tue Nov 16, 2010 2:18 am

Damned I have missed this hidden collection under a falacious title :shock:
:mrgreen:
1
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Raytracer (1.1.0) — 08 September 2010

Postby thomthom » Tue Nov 16, 2010 8:23 am

Panga wrote:EDIT :

Hi Thomthom,

I made a Test under SU8, and it Works pretty well. Until now, I test it with a max of 10 000 rays, and it takes about 15 seconds to calculate, so It's pretty fast. The only thing is it seems that some directions are ignored by rays, see on the picture below :

Sorry for the last reply - but I never noticed this edit. (Don't think edits marks the topic as unread.)
As mentioned in the first post, SU8 has a nasty bug in the raytracer. Only thing one can do is wait for Google to fix it and release a new version.
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] Raytracer (1.1.0) — 08 September 2010

Postby davidlouis » Tue Sep 27, 2011 9:59 am

Hi Thom

I am getting a few weird results with the drop component option...
I thought I would try an test with a series of cars on a slope to simulate a parking lot scenrio.

??? :o There are some non conformers

Test file attached.

Cheers

Dave
0

davidlouis 
 

Re: [Plugin] Raytracer (1.1.0) — 08 September 2010

Postby thomthom » Tue Sep 27, 2011 10:25 am

Drop by Bounds, right?

I see the car crashes as well... :?
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] Raytracer (1.1.0) — 08 September 2010

Postby davidlouis » Tue Sep 27, 2011 10:56 am

Yup...

Maybe Magneto is in the area...
0

davidlouis 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: No registered users and 10 guests

Visit our sponsors: