11 Replies Latest reply on May 30, 2014 1:10 PM by Harold Brunt

    Ray tracing (?) a shape from a plane to a curved surface

    Trevor Dunnett

      Hello board,


      Glad to be a part of the community.


      After searching the boards and online, I haven't been able to find exactly how to accomplish projecting through a shape located on a plane to a curved surface.  A sample of what I am trying to do is attached.  Ideally, I would like to know what the shape would be on the curved surface (revolve) if a light were shone through the splined extrude on the plane located a distance from it. Using project curves this could be accomplished (from what I gather) but only with paralell rays. I would like to see the angled rays and be able to adjust the extruded length of the shape in order to be able to adjust the corresponding shape on the surface. I hope this explanation is clear.


      Any help would be greatly appreciated.




        • Re: Ray tracing (?) a shape from a plane to a curved surface
          Brian Catanzaro

          Be careful.  This could be a tough problem.  You've got 3D geometry.  I do this for a living...


          Is this for fun, for a customer, for a nice looking picture, or for a computation / instrument?


          If this were a simple 2D problem, you could set up some constraints to achieve (angle of reflection) = (angle of incidence).  If that is the case, I've "traced" rays on a simple plane with constraints in the sketch plane.


          For a 3D problem, you need to:


          1. Find the intersection of a ray (line) with the surface
          2. Find the normal of the surface at that point
          3. Define a plane that includes the vector that represents the normal and the original ray (line)
          4. Draw a line in that plane wherein the new line has the same angle to the normal as the original line


          It is conceivable that this can be done with macros, API, ... all of which I do. It can also be done with ray tracing software such as Zemax, CodeV, FRED, ...  Each of this ray tracing tools costs as much as SolidWorks.


          Optimizing the shape to achieve a particular goal (e.g. optimizing the spline to get a particular pattern of light) is non-trivial.  With simple geometry (e.g. conic sections) there are straightforward answers.  For complex geometry or complex goals (e.g. non-uniform light distribution) the problem gets tougher.


          What direction do you think you want to head with this problem?

            • Re: Ray tracing (?) a shape from a plane to a curved surface
              Trevor Dunnett

              Hello Brian,


              Thanks for the repy.  Yes, I was thinking this would be a tough problem. This would be for an instrument that has yet to be desgined so no need for a nice picture.


              I see where you are going with the steps, thank you for the clear explanation.


              Some success was achieved using circles and conic sections to find the projected shape but I wanted to extend this to a more complex shape.  Perhaps it would be easier to combine some simple geometry (e.g. a pattern of circles) for optimization instead of starting out with a spline.  I will go this route and see what I come up with.


              I will also look into the mentioned ray tracing software.


              Thanks again

                • Re: Ray tracing (?) a shape from a plane to a curved surface
                  Harold Brunt

                  I'm kind of late to the party but having a few minutes to kill on lunch I thought I'd give this a whirl. The suggestion of using a lighting or ray trace add-in is the best in my opinion. If you do this type of work frequently then the software will payoff in reduced prototyping. There can be a bit of a learning curve depending on the add-in and your knowledge of lighting/optics. As far as using a rendering software, even though lighting simulation and rendering use many of the same calculations they are not the same. One is for predicting what you will get and the other is for illustrating what you want.

                  I wasn't sure exactly what it is you are trying to simulate so i just blew a bunch of light at the revolve from just behind the squiggly cutout. There's really not much of a hard edge from this so I'm not sure of what you are expecting.

                  revolve screen grab.JPG


                  The Add-In is OptisWorks 2014 running in SW2014.

              • Re: Ray tracing (?) a shape from a plane to a curved surface
                Jamil Snead

                What kind of light source are you imagining? Do you want a point light somewhere inside the tube or at the outer end of the tube? Or are you thinking like a wall of light on one side of the tube that can only go through it and not around it?

                  • Re: Ray tracing (?) a shape from a plane to a curved surface
                    Trevor Dunnett

                    Hi Jamil,


                    The light would completely fill the tube (or extruded spline shape), so a wall, and be projected out the other side onto the revolved solid. The length of the tube (and position) would then determine the pattern coverage on the revolve.

                      • Re: Ray tracing (?) a shape from a plane to a curved surface
                        Jamil Snead

                        Have you thought about rendering that scenario? I'm not exactly sure how you could setup the light, maybe a series of point lights around the far edge of the tube. And I guess you'd want to turn off reflections because you are only concerned about direct light, right? The thing that sucks about that method is that its not very easy to see the resulting shape.



                        • Re: Ray tracing (?) a shape from a plane to a curved surface
                          Erik Bilello



                          First off I'm not even a ray tracing novice so I may be missing the point entirely, but if I understand correctly it seems to me you might be able to use draft to get useful results in at least some situations.  You would have to extrude a solid or surface (I just noticed you can add draft to surfaces. I'm sure I've looked in the past and couldn't.) to draft. Then make an intersection curve and hide (or delete) the body or surface.

                          For this screenshot I just made a solid with some draft added and used an additional sketch line to extrude at an angle (I assume that might represent an off center light source OK if that was a situation).  The degree of draft I could get was limited to the maximum that didn't result in the surface intersecting itself, an obvious limitation to this method.  If you add the draft as a separate feature you could vary the results by changing the type of draft and its pull direction

                          DRAFT AT  ANGLE.PNG

                            • Re: Ray tracing (?) a shape from a plane to a curved surface
                              Jamil Snead

                              That method would give pretty good results if the light source were supposed to be a point light (located where that drafted surface would converge). But since it is supposed to be a wall of light it gets trickier, because light will sneak in at every angle and the geometry of the tube will affect which rays will pass through. For example in your attached image light should be shining through the tube perpendicular to the view in that small section at the bottom where you can see through it.


                              If it were a circular tube then it would be easy and you could use this method with the convergence point halfway along the tube (so the extreme edges of the light field would form an hourglass in the tube). But with this weird shape it doesn't quite work out that way.

                        • Re: Ray tracing (?) a shape from a plane to a curved surface
                          Trevor Dunnett

                          Jamil and Erik,


                          Thanks for the tips.  I didn't think of the draft angle approach, perhaps it will at least give me an idea of what to expect.  It would be better than nothing for sure and a more straight forward way of doing it. I will try a few different things and report back.

                            • Re: Ray tracing (?) a shape from a plane to a curved surface
                              Chris Michalski

                              I did an optics project (first ever) and was able to get a trial license of Trace Pro.  They have an interface (Trace Pro Bridge) that lets you work directly in your SW models (like an add-in).  You setup light sources, reflectivities (simply by selecting materials), etc.  It can do A LOT of in-depth things, but it is easy enough that a complete novice can do simple tasks.

                              You can plot incident rays as intensity plots and it takes into account divergence and reflection inside your contoured opening.

                              The only thing I'm not sure is how easily you can plot the contours on that surface.

                              But their tech support was very eager to help.