Showing posts with label scientific visualization. Show all posts
Showing posts with label scientific visualization. Show all posts

Sunday, October 5, 2014

The Heavens Have Foretold Your Doom


At one time or another, many computer animation people have worked to create an illusion of the night sky from earth or of its cousin, a “star field”, which is an imaginary view of the stars from space. Whether this was for their own amusement, for visual effects purposes, or for scientific visualization, these innocents would approach the problem with the assumption that it was going to be easy. How hard could it be, its just a bunch of random white dots, after all. Imagine their surprise when they discovered that doing excellent starfields is far from trivial.

A classic traditional technique to create starfields is to create a cyc, or curved screen, painted black and with very small holes punched in it. Then behind this screen was a curved light source, usually florescent tubes. The camera would be at the center of the implied sphere of the screen and when the room was darkened and the backlight illuminated, you had a curved space of very bright, very small light sources which could be photographed with long exposures when the camera was moving. The result was excellent motion blurred, perfectly antialiased, very high contrast star fields. But ultimately there were certain moves that the motion control camera could not easily do, such as tumble end over end for example, so there was a need to synthetically generate these elements.

Another time honored technique which looked excellent was the painting on glass. Most of the times you saw stars in Close Encounters of the Third Kind (1977) you were seeing an optical composite of a live action element or motion control shot with a matte painting on glass.




Since everyone seems to have to go through the same learning curve, I am providing notes here for what some of the issues facing 3D technical directors as they produce their first starfield and I have written it as a letter to my younger self.


September 19, 1983

Oh, unwary traveler, so proud of your 3D knowledge, your knowledge of geometric modeling, or of animation whether scripted or procedural, and of global illumination; do you think to encompass the heavens with these pathetic tools? Fool, your doom is assured. There are more things in heaven and on earth than are encompassed in your philosophy, or so I have heard, and when you approach the field of scientific visualization you must unlearn what you have learned and embrace the esoteric wisdom. You must open your eyes in order to see the light.

What perils await the unwary, the arrogant, the unlettered?

The first peril is the vast expanse of space. There is the scale of mortal man, then the scale of the solar system, then the scale of one single galaxy, and then beyond. These differences in scales are way beyond what most software packages can handle, so using the 3D positions of everything in a naive fashion is unlikely to work.

And that renderer you are so proud of.  Does it do all its calculations of space in 64 bit floating point or even higher precision?   Most renderers, with a few notable exceptions,  do the majority of their work using single precision floating point which may be adequate for a giant robot or two, but falls apart in the vast distances of space.  

The second peril involves the issue of filtering of what is very untypical samples.  Most scenes render surfaces with various lighting applied.   But a great deal of what you wish to render are stars but what are stars? Stars are huge things, but they are (for all practical purposes) infinitely bright and infinitely small (on the screen). The amount of energy concentrated in a single pixel may be immense, but the pixel next to it may have very little or no energy at all. And what happens under those circumstances when you move the camera? Well, it aliases, of course, terribly. Furthermore, if one has modeled stars very far away and you are using point sampling of one form or another to simulate area sampling, then if you are not careful, some of your samples will miss and you will have aliasing again.

Part of the solution is to use a good filter and lots of samples and in the choice of filter lurks another threat since as we know a "good" filter, perhaps a 7x7 sinc for example, is likely to have negative lobes, and instead of throwing those values out, you should keep them until the end and even then you should not throw them away. What then to do with them is a mystery left as an exercise for the reader.  The best solution of course would be to have a display that could absorb light as well as emit it, but we wait in vain for the display manufacturers to come to our aid.

And what about those overly bright stars? Will you generate glows and other artifacts? After all we are not just trying to simulate realistic stars, we are often trying to simulate realistic stars as the audience has seen them, and expects to see them.

Although the sky is filled with stars, that is not the only thing that there is. There are also great fuzzy areas known as nebulae and sometimes other galaxies. It turns out that if there is any data for that, it is likely to be volume data. But even if there is no data and you create your own, volume rendering is the best way to render a nebula one might argue. Does your renderer of choice do volume rendering?

Review the following image of the earthling's galaxy.




Do you notice the great areas of darkness? That of course is the infamous "space dust", the so-called Interstellar Media or ISM which must surely exist to hide from us the center of our galaxy where no doubt an entity of great evil exists. Surely you do not think it a coincidence that the space dust would hide what is arguably the most spectacular sight in our little neighborhood? Since most star catalogs do not have the ISM modeled, you may wish to develop a model of ISM in your spare time. If not, the galaxy will not look right unless you simply leave out the stars that are in those areas (which may or may not be be in the catalog anyway as they are impossible to view from earth, at least in the visible bands).

Because you are rendering stars, no doubt you have studied scotopic vision.  It goes without saying that whenever the biped mammals have watched the stars they have, generally, been night adapted. And yet they see color sometimes, perhaps they see Angry Red Planet Mars or Betelgeuse and they perceive the color red.   How then are they seeing color? It may help the seeker of knowledge to realize that “scotopic” is named for the Skoptsy sect of religious devotees whose most notable doctrine is of male castration.  (see link below)

Of course I am sure when you move the camera you will motion blur everything. Oh yes, what do you plan to do with the speed of light issue? I am sure you will come up with something.

So, foolish mortal, you have been warned.

These are just the first of the issues you must address for a proper starfield.

Fools may go where wise people fear to tread.

Sincerely,
A Friend.



___________________________________________________________


Scotopic Vision

The Skoptsy

Close Encounters of the Third Kind (1977) on IMDB

Saturday, October 4, 2014

A New Star Catalog is Always a Cause for Celebration


A new star catalog is always a cause for celebration. Anyone who does more than dabble at astronomy visualization realizes that it is getting ahold of the data that is the sine qua non of serious work.

And yet getting the data is just the first of your many challenges. Very soon after downloading the data you will realize that one needs to have done some advanced study in astrophysics and/or have the services and advice of an astrophysicist or two in order to get anywhere. Without one or the other or both, the would-be visualizer will soon feel that he or she is lost in the forest on a moonless night.

But getting the data is the first necessary step, so it was with great pleasure that I read about the newly announced star survey with the catchy title of The second data release of the INT Photometric Hα Survey of the Northern Galactic Plane (IPHAS DR2)

And what is in this fabulous new survey?
The INT/WFC Photometric Hα Survey of the Northern Galactic Plane (IPHAS) is a 1800 deg2 imaging survey covering Galactic latitudes |b| < 5° and longitudes ℓ = 30°–215° in the r, i, and Hα filters using the Wide Field Camera (WFC) on the 2.5-m Isaac Newton Telescope (INT) in La Palma. We present the first quality-controlled and globally calibrated source catalogue derived from the survey, providing single-epoch photometry for 219 million unique sources across 92 per cent of the footprint. The observations were carried out between 2003 and 2012 at a median seeing of 1.1 arcsec (sampled at 0.33 arcsec pixel−1) and to a mean 5σ depth of 21.2 (r), 20.0 (i), and 20.3 (Hα) in the Vega magnitude system.

And so forth.

There are 219,000,000 unique sources in this survey. That is quite a bit more than the 10K star Yale Bright Star Catalog that we all grew up on. (1)

And yet there are certain similarities when you look a bit closer.   Certain subtle indications that suggest that the compilers of this fabulous expanse of data are adepts of the esoteric knowledge of astrophysics and that this data is intended for other members of this elite group.

In order to brace you for the tasks to come, should you decide to take on the challenge of visualizing this august data set, this post will present some first principles that are important for someone from the world of 3D as they step into the galaxy of creative decisions to be made and the arcane knowledge to master before the images latent in this esoteric compendium will be revealed.

I myself was first introduced to this knowledge during my brief but rewarding tenure on the Digital Galaxy Project portion of the rebuild of the Hayden Planetarium at the American Museum of Natural History in New York City.   Everyone on that project was a dedicated idealist with stars in their eyes.(2)

Because, you see, this dataset, like most astronomy datasets, is not intended to be for computer animation people. It is first and foremost to help scientists in the field, both those associated with the survey itself and those in the larger field of astrophysics, do their research. If people want to use it to “visualize the data” or make interesting pictures, that is all well and good, but that purpose is much further down the list of intended uses.




If we want to visualize the night sky what information would we ideally want? Well, we might want the 3D position of the stars, the brightness of the star, the color and presumably the type of star, as well as information about other objects in the sky that are not stars. This is a short list, there are actually many other things one might want to know for visualization purposes, but lets stop here. Ironically, a normal star survey or catalog does not generally have any of this information. At least not directly.

That is because what scientists are looking for in a star survey are the facts as they were observed. They may also be interested in your interpretations of the facts, but first and foremost they are interested in the data and how it was collected.

That means that instead of the 3D position of the “star” which we do not observe directly, except in a few exceptional cases, what the star catalog has is the position of the star as observed from earth on an imaginary 2D spherical coordinate system, a virtual sphere around the earth. In other words, the catalog does not say where the star is, but rather what direction it was observed to be from earth. The survey does not contain how bright the star was, or even if it was a star, but rather the spectra and intensity of the energy source as observed with the specific instrument. From that spectra, and from other information about the source of energy, one can deduce the type of star it probably is, but that is an interpretation of the data, not the data itself.

The star catalog or survey will not report the “color” as one normally thinks of such things, whether in RGB values, or CIE or other systems, but rather what was observed by the specific instrument or instruments used to collect the information. From the information in the catalog and the operating characteristics of the sensor one can derive spectra and from that a handy “color” in the visible bands if one so desires.

Nor is there any particular guarantee that the catalog is comprehensive, in some normal sense of the word. The authors of the catalog are not guaranteeing you that this survey contains all possible “stars” in the sky, or part of the sky. Instead what they are reporting here is the information about what they observed, and often some measure or estimate of how complete it is. The famous Messier catalog is not a complete list of anything, except the list of objects that Messier did not want to be bothered with anymore in his search for comets.

In a similar fashion, the data does not tell you how bright the star actually is, if it is a star, but tells you the intensity of the source as observed from earth. Again, an astrophysicist has various techniques to convert the apparent magnitude of the source to the absolute magnitude, if that is what you need.

The new star catalog has 219 million unique sources which may or may not be stars, and a variety of information about each, including some derived information (e.g. a probability that the specific source is indeed a star).

But it won't tell you anything about ISM (interstellar media), H2 regions and so forth.

When downloading the data, you can choose to download prepared datasets of the survey, or you can choose which data fields you want to review.  There are 99 different fields, and a dozen or so different formats you can get them in.  Just getting the data will probably take several days.

This post is the tip of the iceberg of what you need to know to do visualization from astronomy datasets but we will reserve these other topics for later posts.

The announcement can be found here

The database can be found here

______________________________________________

Notes

1. The Yale Bright Star Catalog is a famous dataset of the 10,000 or so brightest stars visible from earth. These are the stars that one could typically see from earth on a clear night with the naked eye from somewhere on the planet. It is a famous catalog in part because it was widely distributed even in days before the Internet or the Arpanet.

2. There were many, many people on this project which was part of a much larger project to rebuild the Hayden Planetarium and the entire north side of the American Museum of Natural History. Many people thought we were from Mars.  The cast of characters included such luminaries as Dennis Davison, Neil deGrasse Tyson, Carter Emmart, Frank Summers, Aram Friedman, Loretta Skeddle, Julio Morano, Benjy Benjamin, Ron Drimmel and many others.  And of course, your humble author, was also briefly a consultant on this project. 



Sunday, May 18, 2014

Scientific Breakthrough in Visualizing 3D Blood Leads to Bidding Frenzy



All Hollywood has been abuzz with rumors of a new technology which shows blood in 3D in a much better way. “This is what we have been waiting for”, said an anonymous studio executive, “what we have been begging scientists for all these years”.

The technology, created by a team at the Universidade Federal de Minas Gerais in Brasil, is said to be able to solve problems in visualizing blood. And not just any blood, blood in 3D in particular.

“Don't expect me to be able to understand scientific mumbo jumbo”, said one executive who was part of a studio bidding team, “I don't know and I don't want to know. What I know is that the audience wants blood and more of it”.

“For years we have been waiting for computer animation to come up with something better than Technicolor Blood #1 and #2, but they have let us down”, said the executive. “Now we don't need to wait for those four-eyed geeks any more, we have the blood we have always wanted and they can go back to their workstations and rot for all we care.”


Is a remake of Fantastic Voyage in 3D in development?


Rumors of the new technology leaked out Monday via the various creative agencies who reported a strong, new interest from the studios for properties that can exploit the new technology. According to Creative Artists, they are seeking all spec scripts with “blood” in the title. “Bloody Monday, Bordello of Blood, Blood in Her Eyes, Oceans of Blood, Tsunami of Blood.... all of these are possible, anything is possible today. We are talking 6 and 7 figure deals as long as people can act fast and write bloody”.

Global Wahrman was able to reach lead author of the paper, Dr. Paula Rosas, in Brasil and asked her what she thought about the excitement that her paper had created. “We have no idea what these Yanqui morons are talking about,” she said, “but if they want to give us a bunch of US Dollars, we are happy to take them. These people seem to be totally crazy!” she laughed.

The paper, entitled Total 3D imaging of phase objects using defocusing microscopy: application
to red blood cells by Rosas, et alia, can be read at the following links:

Abstract:

Paper:


Wednesday, February 19, 2014

Order Out of Chaos in Pi (1998)


NB: The following does not contain a spoiler but it does refer to one of the fundamental concepts of the movie Pi (1998)..

There is a sequence in the movie Pi which I am very fond of and which I wish to bring to your attention.  The purpose of the sequence is, imho, to explain to the audience what is meant by the idea of nature exhibiting mathematical principles.  This is a rather abstract concept for our filmgoers who are used to a steady diet of giant robots and teenage lust dilemmas.

The heart of the movie Pi (1998) by Darren Aronofsky is the search by a mathematician for a number, a number which describes the underlying structure of reality. In a sense this missing number would be to chaos theory what 3.14159 is to geometry but even more profound, it would be the single number that is the key to understanding the chaos that is our universe. Finding such a number would bring meaning to randomness, and order out of chaos. It would change everything: one could predict the weather or know which way Wall Street was going to go, and this very same number may even contain the secret name of God, according to some orthodox Jewish mystics.

Of course no such single number exists, that we know of, but its still an amusing premise and Aronofsky extracts some entertaining plot points from the idea.

The filmmaking problem becomes how do you explain to a general audience what it means to say that there is mathematics underlying the structure of reality. The audience for Pi will be a bright independent film going crowd, but likely math is not their strong subject. Probably most of the audience gets no closer to number theory than figuring out how to calculate the mortgage on their house or the interest on their student loan. So how do you explain this to them?

Well, one way to do this, and the way I think would also be entertaining, would be to stop the movie, bring up a white board, and have a famous mathematician give a short lecture on the origins and meaning of chaos theory. But there is this age old bias against this sort of thing in the conventional and anti-intellectual motion picture business, so giving a lecture in the middle of the film is out.

How else would one present the idea that that there is math everywhere in nature?

I put the 2:28 minute sequence up on Youtube and the right thing to do is to watch it before I say anything more. The mathematician is the guy sitting at the counter reading the paper.

The sequence is at http://youtu.be/wQnaMUoC1G8



 

                                  





So Max, our mathematician, is at the counter in a coffee shop trying to get some work done when someone he has recently met, but doesn't really know, comes in. Its Lenny, the orthodox student of Jewish mysticism who proceeds to explain the number theory of the Gematria (1) to Max. The idea is that Hebrew is all numbers and the Torah is a long series of cyphers and crossword puzzles. As Lenny starts to add up the "garden of Eden" and the "Tree of Knowledge", while Max looks on, he comes up with two numbers in the Fibonacci sequence. Max hijacks this discussion of numerology in the Torah and moves it to more standard high school math.   The Fibonacci sequence is one of those concepts that keep mathematicians happy because there are so many uses and weird coincidences, but the only one that Max/Aronofsky goes for here is that you can use the Fibonacci sequence to calculate Theta which is a number that describes a kind of spiral.   So we go effortlessly from Torah numerology to Fibonacci numbers to spirals and boom we are home.   All that is left to do is smoke your cigarette or pour cream in your coffee and the point is made.

"You see", says Lenny, "there is math everywhere".

I still think having a mathematician give a lecture would have worked, but this is probably more concise and any excuse to discuss numerology is OK by me.
__________________________________________________

For an introduction to Fibonacci numbers see

An introduction to Numerology in general

A reasonable introduction to Gematria and Jewish Mysticism in general

A Gematria Calculator

Pi (1998) on IMDB

____________________________________________________

Notes

1. Actually he fails to explain the Gematria to Max, getting a variety of things wrong but hey its good enough to get the point across.

Friday, January 24, 2014

Semi-Automatic Ernst Haeckel & Procedural Modelling


The following demo is online but only while my server is up and until AT&T changes my IP number. Go to http://108.232.26.40/mscript53/mscript.html.  

Type "H" for help information.

Boy is it slow!   I think that is the fault of the speed of the upload of my internet connection.  Not all that interactive on this server, I am afraid.  But if you are patient, it should refresh.  And a "reload" gets a whole new set of objects.


Generations of computer animators have been inspired by Ernst Haeckel (1834-1919), famed and sometimes controversial German scientist and artist, whose Ontogony Recapitulates Phylogony is one of the more famously incorrect, yet memorable, scientific principles of the natural sciences.

But for us digital dependent imagers, it is his meticulous drawings of the natural world that hold endless appeal. Obsessive, stylized, and completely delightful, there isn't a one of us who would not be thrilled to own a print of one of his works on his or her wall.

Whether Radiolarian or Anemone, his Kunstformen are an endless inspiration.






I wrote a modest program to generate small, probably water based organisms inspired by the master. Although the results are no where near where they would need to be be worthy of the art that inspired them.   I need to emphasize that I am trying to duplicate Haeckel, although it almost sounds that way, nor am I trying to recreate the fabulous range of creatures.  I am trying to procedurally define a class of objects that somewhat resemble what you might see in a microscope looking at a drop of pond water ... one of the classes of those creatures, not all of them by any means.

The idea is that you are looking at a semi-automatic catalog of obscure life forms, each of them different, yet related by an unknown (to the viewer) process or processes.

There is also some shader stuff going on to try and achieve a certain technical look.  There is much more to do there.

Each time the program's browser page is refreshed it comes up with a new set of objects. It was written in Webgl.  Of course that wont work on the following images, it only works when running it live.  If you are lucky my server will be up and the IP number at the top will be working.  (One day I will have my own server or a server I can use with a real, known IP number.)

The creatures and their look is defined by about 32 (or so) parameters.  8 of these parameters define the physical object geometry, 8 define an overall look, and the rest are miscellaneous parameters to define things like scale and overall reflectivity.  










Ernst Haeckel on Wilipedia

Die Radiolarien

Friday, October 25, 2013

The Mighty Sphere


About two years ago, I decided to learn NVIDIA's GPU programming environment, CUDA. I wrote a volume renderer in it which can render anything you want as long as it is a sphere.

The problem of course with volume rendering is getting data to render. Volume datasets are usually associated with scientific visualization and when you can get them at all they are not trivial to process. They are real data about real things and it requires serious work to make something of them.

So, for my tests I used normal 3D objects but made every vertex a sphere. It turned out pretty well. Here are two test images, one with glowy spheres and one with spheres that were more hardedged.

You get extra credit if you can figure out what they were originally.








Give up?  The one on the bottom is an upside down SR-71.   The one on top is something with a backbone, you can see the vertebrae clearly.  Dont remember what it was, though.

Sunday, March 17, 2013

Neil deGrasse Tyson and the Importance of Science Education



While we are on the subject of science education, c.f. the post on "Giant Intelligent Vegetable on Mars", I am happy to see that my friend Dr. Tyson is doing his job and speaking out about the importance of science and the importance of funding science and science education.

A recent NY Times article has an interview with Dr. Tyson in which he spins the recent meteor strikes into an impassioned plea for more science funding.

One of the many fringe benefits of working at the Hayden Planetarium many years ago was to be able to work with the many idealists at the American Museum of Natural History (AMNH), first among them being Neil deGrasse Tyson.

Neil is unlikely to use the word "motherfucker" in public.

To give you one example of this idealism, and because it always makes me laugh, at a meeting about the Digital Galaxy that we were building for visualization, the project leader, Dennis Davison, asked what measures we were taking to insure "the integrity of the data".   We hardly ever talk about the "integrity of the data" when working on Zombie movies or blowing up planets, generally speaking.

It is a slight exaggeration to say that Neil's job is to be public and get kids (and adults, but mostly kids) excited about science.  And he does this really well.  Part of the secret to his success is that he is completely sincere in doing so.  He thinks science IS important, and he thinks science education is very important and he charges out there in public and uses every opportunity to say so.

When the Hayden was being rebuilt and the AMNH was racing towards its end of the fake Millennium deadline, Neil engaged in a dialogue to have the AMNH create a small astrophysics department.  What you may not be aware of is that there have been almost no new astrophysics departments in this country since the great expansion in the science in the 1950s as part of the Cold War and the Space Race.   The AMNH was not jumping up and down about adding more costs  to their overhead, but Neil insisted and he won.  The point is, the AMNH is the only organization in this country (that I am aware of) that has as its mission doing real science and communicating results directly to the American people.  In other words, their mission is not to train more graduate students, Universities do that, and the AMNH has a good relationship with Columbia and many other schools.  The AMNH's job is to do both research and direct science education to the general population.   Hence, if you have a Planetarium, you should also have an Astrophysics department.

Neil has an interesting background, the whole story of which I am not completely clear on.  But I do know that he went to the Bronx High School of Science, scholarship to Princeton, and is a living example of the promise of higher education to create opportunity for minority groups (although I suspect that Neil is something of a ringer in this regard).

Astrophysics is a very tricky field.  It is incredibly elitist and the field as a whole can be quite nasty, and I assure you that Neil's immense popularity wins him no friends in the field of Astrophysics.  But he is on a mission, he is one of the most recognizable people in NYC, and I assure you he is completely sincere.

By the way, Neil is unlikely to use the word "motherfucker" in public, but I thought that the above image of Neil making a point at some public forum was very funny, so I stole it from a post someone did on Facebook.

_______________________________________________

American Museum of Natural History
www.amnh.org