Ray tracing - how to numerically integrate the equation of the ray

Click For Summary
SUMMARY

The discussion focuses on numerically integrating the ray path equation in a continuous isotropic medium with a variable refractive index, represented by the equation d/ds(n dr/ds) = grad(n). The user has implemented a custom integration method but found qualitative consistency without quantitative accuracy. Suggestions include verifying the unit length of the vector dr/ds and considering higher-order Runge-Kutta methods for improved results.

PREREQUISITES
  • Understanding of ray tracing principles in optics
  • Familiarity with numerical integration techniques
  • Knowledge of the Runge-Kutta methods for solving differential equations
  • Basic concepts of vector calculus and gradient operations
NEXT STEPS
  • Research the implementation of the Runge-Kutta methods for numerical integration
  • Study the properties of continuous isotropic media in optics
  • Explore advanced numerical methods for solving differential equations
  • Review literature on ray tracing algorithms in varying refractive indices
USEFUL FOR

Researchers, physicists, and computer graphics developers interested in ray tracing, numerical methods, and optical simulations.

carlos-carlos
Messages
10
Reaction score
0
In a continuous isotropic medium having refractive index n, (not constant)
the ray path can be described by the following equation

d/ds(n dr/ds)) = grad (n)

with an obvious meaning of the symbols (for they who can help me!).

I wrote a code to calculate the ray path. I found result qualitatively consistent but not quantitatively. I think that the integration procedure I used is wrong (I used a simple one,
that I set up on my own).

Can anybody help me?
Can anybody suggest me a paper or book where to read an algorithm?
Has anybody a source code to integrate it? (I would need just the core instructions).

Thanks Bye
 
Science news on Phys.org
Just to make sure, the equation you are actually integrating over is the following, correct?

\frac{d}{ds}\frac{dr}{ds} = \nabla n - \left(\nabla n \cdot \frac{dr}{ds}\right)\frac{dr}{ds}

Note that dr/ds is just a unit vector you want as function of s, and the above equation maintains unit length of the vector.

So the thing you should check in your code is if ||dr/ds|| = 1 all the way along the path. If not, you either have an error in the method or the code.

Now, not knowing specifically the kind of function you have for n(r), it's a little hard to say how advanced a method you should be using, but if brute force forward Euler is not working for you, try one of the higher order Runge Kutta methods.
 

Similar threads

Replies
12
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 42 ·
2
Replies
42
Views
16K
Replies
9
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 9 ·
Replies
9
Views
12K