|
46 | 46 |
|
47 | 47 | In a real camera, the shutter remains open for a short time interval, during which the camera and |
48 | 48 | objects in the world may move. To accurately reproduce such a camera shot, we seek an average of |
49 | | -all the instant images that the camera perceives while its shutter is open to the world. |
| 49 | +what the camera senses while its shutter is open to the world. |
50 | 50 |
|
51 | 51 |
|
52 | 52 | Introduction of SpaceTime Ray Tracing |
53 | 53 | -------------------------------------- |
54 | | -We can get a random estimate of a single photon by sending a single ray at some random instant in |
55 | | -time when the shutter is open. As long as the objects are where they should be at that instant, we |
56 | | -can get an accurate measure of the light for that ray at that same instant. This is yet another |
57 | | -example of how random (Monte Carlo) ray tracing ends up being quite simple. Brute force wins again! |
| 54 | +We can get a random estimate of a single (simplified) photon by sending a single ray at some random |
| 55 | +instant in time while the shutter is open. As long as we can determine where the objects are |
| 56 | +supposed to be at that instant, we can get an accurate measure of the light for that ray at that |
| 57 | +same instant. This is yet another example of how random (Monte Carlo) ray tracing ends up being |
| 58 | +quite simple. Brute force wins again! |
58 | 59 |
|
59 | 60 | <div class='together'> |
60 | 61 | Since the “engine” of the ray tracer can just make sure the objects are where they need to be for |
|
95 | 96 |
|
96 | 97 | Managing Time |
97 | 98 | -------------- |
98 | | -Before continuing, let's think about time, and how we might manage it across one or more renders. |
99 | | -There are two aspects of shutter timing to think about: the time from one shutter opening to the |
100 | | -next shutter opening, and how long the shutter stays open for each frame. Standard movie film used |
101 | | -to be shot at 24 frames per second. Modern digital films can be 30 or even 60 frames per second. |
102 | | -Each frame can have its own shutter speed, which need not be -- and typically isn't -- the maximum |
103 | | -duration of the entire shutter period. You could have the shutter open for 1/1000th of a second per |
104 | | -frame, or 1/60th of a second. It may surprise you to learn that for most film motion pictures, the |
105 | | -screen is actually dark more than it is lit up with the movie frames! |
| 99 | +Before continuing, let's think about time, and how we might manage it across one or more successive |
| 100 | +renders. There are two aspects of shutter timing to think about: the time from one shutter opening |
| 101 | +to the next shutter opening, and how long the shutter stays open for each frame. Standard movie film |
| 102 | +used to be shot at 24 frames per second. Modern digital movies can be 24, 30, 48, 60, 120 or however |
| 103 | +many frames per second director wants. |
| 104 | + |
| 105 | +Each frame can have its own shutter speed. This shutter speed need not be -- and typically isn't -- |
| 106 | +the maximum duration of the entire frame. You could have the shutter open for 1/1000th of a second |
| 107 | +every frame, or 1/60th of a second. |
106 | 108 |
|
107 | 109 | If you wanted to render a sequence of images, you would need to set up the camera with the |
108 | 110 | appropriate shutter timings: frame-to-frame period, shutter/render duration, and the total number of |
109 | | -frames (or total shot time). If the camera is moving and the world is static, you're good to go. |
110 | | -However, if anything in the world is moving, you would need to add a method to `hittable` to |
111 | | -broadcast the current shot timing to every object in the world. This method would then provide a way |
112 | | -for all animate objects to set up their motion during that frame. |
| 111 | +frames (total shot time). If the camera is moving and the world is static, you're good to go. |
| 112 | +However, if anything in the world is moving, you would need to add a method to `hittable` so that |
| 113 | +every object could be made aware of the current frame's time period. This method would provide a way |
| 114 | +for all animated objects to set up their motion during that frame. |
113 | 115 |
|
114 | 116 | This is fairly straight-forward, and definitely a fun avenue for you to experiment with if you wish. |
115 | | -However, for our purposes right now, we're going to proceed with a drastically simplified model. We |
116 | | -will be render only a single frame, assuming a start at time = 0 and ending at time = 1. Our first |
117 | | -task is to modify the camera to launch rays with random times in $[0,1]$, and our second task will |
118 | | -be the creation of an animate sphere class. |
| 117 | +However, for our purposes right now, we're going to proceed with a much simpler model. We will |
| 118 | +render only a single frame, implicitly assuming a start at time = 0 and ending at time = 1. Our |
| 119 | +first task is to modify the camera to launch rays with random times in $[0,1]$, and our second task |
| 120 | +will be the creation of an animated sphere class. |
119 | 121 |
|
120 | 122 |
|
121 | 123 | Updating the Camera to Simulate Motion Blur |
|
155 | 157 | Adding Moving Spheres |
156 | 158 | ---------------------- |
157 | 159 | Now to create a moving object. I’ll create a sphere class that has its center move linearly from |
158 | | -`center0` at time 0 to `center1` at time 1. (It continues on outside that time interval, so it |
159 | | -really can be sampled at any time.) |
| 160 | +`center0` at time=0 to `center1` at time=1. (It continues on indefinitely outside that time |
| 161 | +interval, so it really can be sampled at any time.) |
160 | 162 |
|
161 | 163 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
162 | 164 | #ifndef MOVING_SPHERE_H |
|
0 commit comments