****************** StarScape. doc ****************** StarScape is copyright (c) 1990 by Mark Balaschak. It can be distributed freely, so long as there is no charge for the program. Handling fees can be charged for copying, handling, or distribution of copies of StarScape, provided the executable remains unaltered and this file, with the copyright notice unaltered, accompanies it. Use of any part of this code in a commercial program without the written permission of the author is prohibited. **************************************************************** What Does It Do? You stand on the bridge of your starship. "Steady at 0.75 lightspeed, sir," helm reports. You stare moodily at the forward viewscreen. In it, the stars look -- how? That's why I wrote StarScape. StarScape simulates the visual appearance of the sky from the standpoint of an observer moving at relativistic speeds. The observer is at the center of a celestial sphere on which a random starfield is placed. The stars are modeled by point blackbodies with random temperatures and random visual magnitudes. The user selects a speed between 0 and 0.999999985c. The program takes into account relativistic effects to modify the position, color, and magnitude of the star, and displays the appearance of the starfield at that velocity. The universal 3 degree blackbody background is also included as a source. The stars DO NOT go whizzing past as you watch. What Will It Run On? Any Amiga, as far as I know. It releases all resources, won't use up all your memory, will recognise and use a 68881 if you've got one hooked up Commodore fashion. It will work on NTSC and PAL machines, and if you use MoreRows or something to make your screen bigger, it'll figure it out. (I'm not that clever. Thank John Toebes and his article in the Dec '88 Amiga Transactor.) It will also compensate for the differences in pixel sizes so that the stars will rotate in relatively true circles as you spin your ship. If you have a 68881 hooked up Commodaore fashion with your 68000, Starscape should find it and use it. For that reason, YOU MUST HAVE THE FILE "mathieeedoubbas.library" IN THE LIBS DIRECTORY OF ANY DISK YOU RUN StarSCAPE ON. This option slows down the calcs a bit for most, but speeds it up for some. There are three versions, one using halfbrite mode, another ("Star1000") with a different, smaller color map for more mature (ahem) nonEHB Amiga 1000's, and a 68030/68882 version for them what's got the means to use it. I could have put EHB as an option in a single version, but it ended up that I didn't. Why'd You Write This Thing? Ummm, it seemed a good idea at the time. This program was inspired by R.W. Stimets and E. Sheldon's "The Celestial View from a Relativistic Starship," Journal of the British Interplanetary Society, Vol 34, pp. 83-89, 1981. They have a later piece, also in JBIS, that I haven't read, but which is cited in Mallove, E., and Matloff, G., The Starflight Handbook: A Pioneer's Guide to Interstellar Travel, 1989, John Wiley and Sons. Anyway, Stimets and Sheldon cite the basic equations and discuss a computer program, CELESTE, that they used to visualise the starscape. Well, I dragged that article around for a couple years. Then, when my roommate got an Amiga 1000, I decided to do some programming and I started to learn C. This seemed like an ideal project for an Amiga. The "womb room" in Larry Niven's Corbell stories was also in the back of my mind. So What's Going On Here? USAGE: StarScape n or click on the icon. n = number of stars in the sky. If no value is supplied,it defaults to 130. You can edit the icon's ToolTypes to change the WorkBench default. If you specify a REALLY big number, it shouldn't crash the machine -- it'll allocate as much memory as it can, but it'll leave you a couple K of chip ram, and it'll tell you how many stars it did draw. The number of stars affects the drawing time, obviously. A full redraw will do about 1500 stars/min on my stock 2000. There are about 6000 stars visible to the naked eye from earth, so that's a manageable scene to render. I put in a maximum number of 100000 stars just for grins. Okay, so you've started 'er up! A screen gets drawn and the program initialises the starfield, assigning temperatures (colors), magnitudes, and coordinates. This can take a couple minutes. When it's all done, it renders the scene, assuming you're motionless with respect to those stars. You're seeing a roughly 60 degree sector ahead of you in the direction you're traveling. At the upper right of the screen, you'll see "v/c = 0.000000000" in green. The number is your speed, as a fraction of the speed of light. When your speed is written in green, it means the program is not rendering -- you can give it commands and it will respond. If it's written in red, it means the program is rendering. If the program is rendering a small scene (less than 300 stars) it will queue up userinput events. If it is taking a while to render, it will change to checking for user input periodically but will respond to a quit request only. Other user inputs will be discarded. (A quit request = click on the CloseWindow gadget or hit left-Amiga-q). Different star types (O-M) are rendered in different colors: purplish through red. (In the non-EHB version, O and B type stars are both rendered in the same blue colors.) Now change your speed. There's a slider that moves left to right under the title bar. Move it with the mouse. Note that "v/c=" and your speed are now written in yellow. This is to tell you that the speed on the slider is not necessarily the speed at which the scene that is currently on-screen is rendered. The program won't render until you hit the "Enter" key, hit left-Amiga-c, or select the "Calc" item from the "Project" menu. Then the speed will turn red and the scene will be rendered. But you can move the speed around till you get it where you want it, and then tell the machine to render the scene. These days it renders about 2000 stars a minute. You can change the speed in two other ways. Clicking inside the slider box, but not on the slider, will move it in small steps. Hitting the comma and period keys will also change the speed by a small step, but the machine will also start rendering immed iately, signified by a speed drawn in red.(I picked those keys because they have the "<" and ">" signs on them). Using these keys is a good way to see the effects of incremental changes in speed. When the picture is redrawn, the scene changes. You'll probably notice that there are more stars in the picture and you may notice that there are more blue and green and white stars. Let's take the effects one at a time. The colors: just as the sound of an approaching siren sounds higher than the same siren not moving, the light of the stars you are moving toward is shifted upward in frequency. Now all those stars give off varying amounts of light of different colors (frequencies), and all frequencies are affected by this shift -- called a Doppler shift. The distribution of colors (or spectrum) from a star can be described reasonably well by a mathematical expression called Planck's Law. Planck's law will give the spectrum of an ideal radiating body (also known as a "blackbody") heated to a teperature T. Now a neat thing about the universe is that the sum of all the shifted colors from a moving blackbody is still the spectrum of a blackbody, only at a different temperature -- cooler and redder if it's moving away from you, hotter and bluer if it's moving toward you. So the stars you're moving toward appear hotter. Other effects (see the articles cited or a good relativity book) change the stars' brightnesses. Now, more stars. Well, as you go faster, the stars' positions appear to shift forward. The classic analogy, which I've never thought was all that enlightening, is that if you walk forward in the rain, the raindrops appear to be falling at a slant coming from somewhere in front of you. If you replace the raindrops with photons, then you get the idea behind relativistic aberration. If you go REALLY fast, then you start banging into photons that came obliquely over your shoulder from behind. Because yo u hit 'em with your eyes looking forward, it looks as if they came from in front. The program starts off with you looking forward, in the direction of travel. If all I've said is true, then behind you there should be fewer, redder stars. That's if I wrote this program right. Did I? Thought you'd never ask. You can look behind you in two ways. The "Cursor-Left" and "Cursor-Right" keys will turn you around a vertical axis in small increments. The keys don't repeat -- you have to push them once for each increment. Selecting the "Af t" and "Side" entries from the "View" menu will show you what you'd see looking backwards or to the side while traveling forward. These selections can be chosen by hitting "Left-Amiga-a" and "Left-Amiga-s." The machine draws the new scene using precalc ulated stuff, so yawing around behind you happens real fast. You can also roll your ship around an axis parallel to your velocity. The "Cursor-up" and "Cursor-down" keys do this. It's slower than looking backward, but faster than a redraw. It's not terribly enlightening, but I put it in for completeness's sake. As you go faster and faster, eventually you see fewer stars. That's because all the ones that are visible at rest get Doppler shifted out of the visible spectrum. Right now, the program puts in a few infra-red and ultra-violet sources that aren't visible at rest just for fun. At above 0.999996c, the pixel dead forward lights up. Few, if any, stars are around. At this point, the 3 degree microwave background is blue-shifted to a temperature of about 2100 degrees Kelvin. From my calculations, the maximum angular radius of the forespot is .0014 radians and occurrs at v/c = 1-1.02*10-6. Other Options Well, that's most of it, but you've got a few other options. You can change the number of stars in the sky while the program is running with the "NStars" entry in the "Project" menu. (Or RightAmiga-N). It'll bring up a requester and you can just change the number. There ar eabout 6000 stars visible from Earth. A scene that big takes a little while to render (there is a sample image provided) but it's worth it. Time: This puts some enlightening statistics on the screen. Look at your speed. How long would a ship accelerating at 1 g (9.8 m/sec2) take to get to that speed? "Own time" gives you that time as measured by someone on the ship. "Earth time" tells you how long the ship would have been traveling as measured by an observer at rest with respect to the stars at the ship's starting point. "Distance" tells how far away you'd be from that same observer (by his measurement) when you reach your chosen speed. This illustrates time dilation. Notice how far you've traveled in 10 years ship time. The upper limit is ten just on a whim -- it may change in later versions. At some point, one would have to take into account stellar proper motion, and eventually stellar evolution to deal properly with the surroundings. Don't hold your breath while you're waiting for a version that does that, however. Beep?: This will make a noise when a change in speed is done rendering. This is so you can do something else and know when the program's done. I was thinking of adding a ScreenToFront() that would put the picture in front when rendering's done, but I don't want to interrupt the user. I do all the drawing offscreen and blit it on (I'd once had dreams of this happening in realtime as part of a game -- darn, I wish I had a 3000). I've also considered letting the user watch the drawing be built up a point at a time, but decided against it. Maybe I'll add the option later. Draw Menu Uniform: This is to help illustrate the relativisic optical effects. What if all the stars in the universe were white when you were at rest? This toggle makes all the stars in the universe identical in temperature, but doesn't change their positions. Toggle it. What you'll see is concentric rings of different Dopplershifted colors. Play with your speed a bit and you'll see what's happening. Wideband: This remaps the temperatures of the sources onto the range between 3 degrees and one million degrees K. It's to give the viewer a better idea of a universe that has sources other than visible ones. Natural: This is the default. It sets the sources' colors equal to a random value between 2100 deg K and 50000 degrees K. So What Do I Do With This? Well, I did it just to satisfy my curiosity. I'd like to think it might get someone to marvel at the universe a bit. Now, as for concrete things, well, sir, I've a few ideas. If someone were to do an animation of a scene from, say, Larry Niven's "Rammer" or "World Out of Time", you could use it to generate backgrounds. Or Fred Pohl's "StarBow." I wrote the code making major concessions to portability rather than speed. That's because I figure the hardware will only get faster and more capable, and I certainly wouldn't mind if folks ported this stuff around. I'll post the source next version. Refining this, or writing it from scratch, might make a good project for a high school AP Physics class. The equations are pretty straightforward, but there are a few subtleties -- what do you do when you're stuffing a bunch of stars into one pixel? What color on the screen should a black body of a given temperature be? How to handle the 3 degree background? What Are You Going to Do With It? I'd love to move it to a Cray. Then I'd integrate the Planck equations explicitly over the visible spectrum to derive the screen color. And I'd mix the colors additively when several stars are in the same pixel. (Right now, a pixel is the color of the brightest object in it). I'd also put in extended objects such as clouds. I'd like to make a movie showing what it looks like to fly in a starship through our Universe. My Amiga's not a Cray, but I wrote the code with hooks for all sorts of refinements. I could read real star data from a file. The program is aware that there are extended objects and nonthermal sources in the universe. Animation is another possibility. I've learned enough about programming the Amiga in the course of this venture that there are a bunch of refinements I can make in the early code, like implementing the menuhandler with function pointers. I'd planned to eventually use a look-up table for the trigonometric functions, but as the hardware gets faster and we can all afford co-processors, this seems to be more trouble than it's worth. I've got a version almost done now that takes parallax into account as you move through the stars and incorporates a more realistic stellar model. I'd be interested in any responses from folks out there. If you think there's something wrong with this, let me know. If you like it, drop me a line: Mark Balaschak, 4400 East-West Highway #610, Bethesda, Maryland, USA 20814. I can also be reached through the Hallucination BBS (sysop Micahel Malak) (703) 425-5824.