View Full Version : How to simulate light passing through lens and diffracting?
I need to be able to simulate optics systems. How do I set up a series of lenses with specified Index of Refraction (mirrors too), and have a volume light lass through them, being refracted (or reflected) like it would be in reality? I would imagine you need to use some sort of volume caustics, but I really could do with some help.
Thanks in advance,
08-07-2004, 09:37 PM
so simply apply a material to an sphere and change in transparency section its refraction.
08-07-2004, 09:45 PM
right now there's no out of the box solution for diffraction and splitting light.
colors wise there's a shader by bartek that works on the internal volume of the object, but it doesn't interact with the outer environment, it's only to produce a cosmetic effect that helps with realism on glass (I don't think it's based on physical accuracy tho).
Daniel Rind was working ona photon scattering shader to simulate proper diffraction (photon manipulation is basically the only way to achieve it and having it interact with the environment) but I didn't hear anything about it after he posted his first tests.
try and do a search on XSIbase, maybe he completed it.
Thanks for the response ThE_JacO, I've found Daniel's site and he seems to have some nice examples of refraction taking place, but I'm looking for modelling e.g. a laser being bounced off mirrors, and being refracted by lenses, and I'm not sure that his shader will do that; it seems to offer just physically correct (ambient) diffraction, that is, scenery is correctly refracted with chromatic aberrations included.
At the very least, is there a way to alter the profile of a beam of light along it's length in XSI. At least, that would allow me to fake the effect (I hope...). You would think that raytracing would allow you to do this; I don't understand why it won't.
Any help from anyone anywhere would be appreciated! I just set up a proof-of-concept render in 3ds max and my supervisor now wants a pretty (and accurate) version within the month...
08-09-2004, 01:37 PM
if your maths are up to the task (we are talking trivial linear algebra) you should write something yourself.
an option is to write a geometry shader that raymarches thru a list of objects and builds a cylinder out of that, you can then shade it whatever way you want.
another option, slower but still doable and way simplier, is to write your own op, compiled or scripted, to deform a spline when it goes thru a list of objects.
this last method tho has no access to the interpolated shading normals, so after reading an impact you'll have to check the neighborhood yourself and average the correct normal to get a dot from.
if you are after total physical accuracy tho the number of variables and elements to consider scream for a proper module computing app like mathematica.
what is the exact scenario you are looking forward to?
void in an optical chamber with perfect lenses and mirrors or do you need to take into consideration air, manufacturing process of the lens and so on?
are you dealing with a red laser, or anyway some element with a very restricted bandwidth, or are you dealing with light components that will end up being split?
as for your points about raytracing... well the problem is that it traces rays shot from the camera, lights don't have full fledged rays that can go into multiple altered iterations unless you start dealing with photons; that's why a geometry shader to build geometry from a camera (or any ray emitter) is your best bet.
Ideally, what I want to do is create a lens (lathe a spline, or some other technique to create the lens volume), set an index of refraction and set up a monochromatic lightsource passing through the lens, or alternatively set up a flat mirror and have the light bounce off that. In the future I may want to model polychromatic light sources and such optical components as prisms and other dispersive components. Some of the guys in my office (I'm about to start a PhD) are saying that I just need to use the paraxial optics approximation. I can program in C, but I reckon I should probably give myself a chance to learn the basics of XSI first! Having said that, any input you can provide is much appreciated. Thanks for the help.
P.S. I'm amazed that this sort of capability is not standard, as I find it hard to believe that I'm the first person wanting to model simple optical elements in a standard 3d package. Surely someone else has had to do this sort of thing for a commercial, a scene in a film, their own portfolio, etc.
08-09-2004, 02:45 PM
sure other people did, but it's usually done by hand (we are talking "artistically oriented" apps after all) or by writing a simple scop to control a spline.
Frankly I can't see that as being such a common need/instance to justify the development.
honestly, if you have a C background and you are taking a scientific PhD I doubt it will take you more then a couple of weeks to write a generic/reusable op to do this, and I'm saying a couple of weeks assuming you'll also need to study bits and bobs of the SDK while you go.
if you write a simple raytracer (just a tracer capable of detecting collosions and building sequential vectors) in C++ then you are taking half the maths load off the scripted, and slower, part of the operator.
all the operator would need to do is detect bounding box collisions and handle data to the tracer (eventually it can all be compressed in a single matrix4 and the geometry for optimization sake) that will give back the next vector to control the spline.
also for optimization sake, if you already know you will always work with just lenses and flat mirrors, the optimization can be brought a step forward since no precise actual shape is needed, only a bounding plane or transforming from the world space to a reference spline.
it's a fairly classic programming exercise, only you normally do it for path tracing for characters and vehicles.
looking up about those subjects will give you more then enough to start the project, which will be very similar except for the addition of an IOR variable.
I'm not being very helpful I know, since you maybe hoped in an out-of-the-box solution, but I'd say you should take the chance to learn XSI thru an interesting project.
Okay I admit it, I was hoping for an easy option... However, as you say, it's a good way to learn XSI.
By the way, I see various books available for all the other major 3d packages on Amazon and Waterstones, but nothing for XSI. Do Softimage have a monopoly on XSI books? If I'm looking to get up to speed quickly , what would you recommend in the way of supplementary books, etc, or are the included tutorials and guides good enough. In the longer term, I will almost certainly be doing more of this sort of modelling: realistic real-world objects, often with an optics twist (the PhD is on optical data storage - BluRay and beyond!), and I would like to model things as realistically as possible.
Also (sorry, going off topic a little here), I will be running XSI on my windows machine. At work there is a 36CPU Linux-based cluster. Is it possible for me to use it as a renderfarm. If so, could you possibly point me in the direction of suitable resources?
Thanks in advance,
BTW: I personally count any constructive response as helpful, so don't put yourself down. It's great to have nice prompt responses, without the (almost) inevitable taunting of the beginner.
08-09-2004, 06:01 PM
the lack of books is partly because the Softimage userbase has for a long time been made only of professionals (it's never been a hyped app popular between beginners until recently), and when the high-end started being more approachable XSI was basically being written or was still not production proven (that is also why Alias overtook the film market so radically at the time).
It's only recently that XSI started being popular, so there wasn't much market for books, and even less people that had the mix of skills and time to write them.
no monopoly is involved(Softimage actually supports and encourages 3rd parties to put together learning material).
the only book worth buying (altho some say it's a bit too brief on many topics) is probably Experience XSI, the manuals and the SDK reference are pretty good complementary material anyway. It's worth reading them front to back.
there's more choices in video, where you could want to get Softimage's DVDs (everybody who got them insofar seems to be impressed) and some of the 3dtutorial.com videos.
for the scripting/coding part there's close to nothing... yet.
also keep an eye on www.edharriss.com (http://www.edharriss.com) www.xsibase.com (http://www.xsibase.com) www.xsifiles.com (http://www.xsifiles.com) and the various XSIusers sites like Graham's, Daniel Rind's, Claus' and so on.
01-18-2006, 09:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.