# Ray tracing with matrices

• frankR
In summary, the conversation discusses the problem of a glass sphere with a scratched surface and the virtual image of the scratch when viewed through the glass from a specific angle. The conversation delves into the use of matrices to solve the problem and the discovery of a different system of matrices that results in the correct answer. The question of why a diffraction for the scratched surface is not necessary is also brought up.

#### frankR

Here is the problem:

A glass sphere with a diameter of 5cm has a scratch on its surface. When the scratch is viewed through the glass from a position directly opposite, where is the virtual image of the scratch, and its magnification? The glass has an index of refraction n=1.50. Explain the result.

I've constructed a system of matrices that looks like this:

M3*M2*M1

M1 is for the first refraction of the scratch at the sphere's front surface.
M2 is for the translation of the ray through the glass.
M3 is for the second refraction through the second surface of the glass where the viewer is located.

When I multiply the matrices together I get these equations.

yf=-2/3yo + 10/3&alpha;o

&alpha;f=-4/15yo + 1/3&alpha;o

I do not understand how I use the geometry of the ray to locate an image of a scratch. What am I missing in all of this? Did I use the matrix equation properly? What do I do, I'm extremely stumped?

Thanks for any help.

Frank

Nevermind I fiquered it out. Not sure why it's right, but I discovered how to find the correct answer using, a different system of matrices, the correct system. I didn't need to include a diffraction for the scratched surface (apparently). If someone could explain to me why not, I would be greatful.

Thanks

Hi Frank,

Ray tracing with matrices can definitely be confusing at first, so let's break down the problem step by step.

First, let's define the variables we will be using:
- s: distance from the center of the sphere to the scratch
- s': distance from the center of the sphere to the virtual image of the scratch
- d: diameter of the sphere
- &theta;: angle of incidence (measured from the normal)
- &phi;: angle of refraction (measured from the normal)
- n: index of refraction

Now, let's start with the first refraction at the front surface of the sphere. We can use Snell's law to relate the angles of incidence and refraction:
n*sin(&theta;) = sin(&phi;)

Next, we can use the geometry of the ray to find the distance s' from the center of the sphere to the virtual image of the scratch. Since the ray is refracted at the front surface of the sphere, the distance s' is equal to the distance s. So we have:
s' = s

Now, let's move on to the second refraction at the back surface of the sphere where the viewer is located. Again, we can use Snell's law to relate the angles of incidence and refraction:
n*sin(&phi;) = sin(&theta;')

Using the geometry of the ray again, we can find the distance from the center of the sphere to the point where the ray intersects the back surface. Let's call this distance x. We know that the total distance from the center of the sphere to the viewer is d/2, and the distance from the center of the sphere to the point where the ray intersects the back surface is x, so the distance from the point of intersection to the viewer is d/2 - x.

Now, using similar triangles, we can relate the distances s and d/2 - x with the angles &theta; and &theta;':
s/(d/2 - x) = tan(&theta;')

Finally, we can use the equation for magnification to find the magnification of the virtual image of the scratch:
M = -s'/s = -s/(d/2 - x)

Plugging in our values for s' and s, we get:
M = -s/(d/2 - x)

Now, to tie all of this together with matrices, we can use

## 1. What is ray tracing with matrices?

Ray tracing with matrices is a method used in computer graphics to render realistic images by tracing the path of light as it interacts with objects in a scene. It involves using mathematical matrices to perform calculations and transformations on rays of light to determine their paths and interactions with objects in a 3D environment.

## 2. How does ray tracing with matrices work?

Ray tracing with matrices works by simulating the behavior of light rays in a 3D environment. A ray is sent out from the camera position and traced through each pixel on the screen, interacting with objects in the scene as it travels. This process is repeated for each pixel, resulting in a realistic and accurate depiction of light and shadow in the final image.

## 3. What are the benefits of using ray tracing with matrices?

Ray tracing with matrices allows for more realistic and accurate rendering of light and shadow in 3D environments. It also allows for more flexibility in creating complex lighting effects and can produce higher quality images compared to other rendering techniques.

## 4. Are there any limitations to using ray tracing with matrices?

One limitation of using ray tracing with matrices is that it can be computationally intensive and therefore requires powerful hardware to render scenes in real-time. It also requires a lot of memory and storage space to store the data for each ray and its interactions with objects in the scene.

## 5. How is ray tracing with matrices used in different industries?

Ray tracing with matrices is widely used in industries such as animation, visual effects, and video game development. It is also used in fields such as architecture and product design to create realistic and accurate depictions of buildings and products. Additionally, it has applications in medical imaging and scientific research for simulations and data visualization.