ranjit@eniac.seas.upenn.edu (Ranjit Bhatnagar) (12/06/88)
chris@spock.ame.arizona.edu (Chris Ott) writes: >> [Leo Schwab's questions] >> [Will a mirror reflect ILLUMINATION onto a surface?] > > Software that does true ray tracing would definitely illuminate the >object. For example, the ray could be sent from the eye through a specific >pixel on the screen to the object, bounce off the object into the mirror, >and finally, off the mirror into a light source. >> [Will a lens focus ILLUMINATION onto a surface?] > Again, true ray tracing would definitely produce this result. >> The point of the above two questions is to find out if, in general, >> raytracers handle illumination from light bounced off of or refracted >> through other objects. THIS is kind of a subtle distinction, so it's worth looking into. It is certainly the case that any reasonable ray-tracer will correctly model reflections in mirrors, and refraction by lenses. Leo's question, however, referred to illumination by light sources, which is slightly different. Consider a scene containing a light, a sphere, and a mirror arranged so that much of the visible surface of the sphere would be illuminated by light shining off of the mirror. For each pixel in the image, we cast a ray from the eye, through the pixel, and into the scene. A ray hits the sphere, and now we need to find out how to color the ray. We send a ray off to the light source, to see what angle it's at, and whether there are any other objects in the way to cast a shadow. This is standard ray-tracing, and it does not even take the mirror into account. (Where DOES the mirror come in? Consider a ray that comes from the eye and strikes the mirror. It 'bounces off' and might hit the sphere - thus we see a reflection of the sphere in the mirror. This still doesn't affect the ILLUMINATION of the sphere.) So we decide we want to take the mirror into account in our illumination model: when we resolve the ray that hit the sphere, we send one ray off to the light source, and another one to the mirror, to see if it will bounce in the direction of the light source. If the ray bounces into the lamp, we count it as a new source of illumination; if not, we don't. The problem is that there are an infinite number of points on the mirror, and only a fraction of them will actually contribute to the illumination of the sphere - for any given point on the sphere, there is only one point on the mirror that would reflect a ray of light from the light source (assuming a point source) to that point on the sphere. The same argument applies to refraction. As long as we are tracing rays backwards - from the eye to the light source, which is of course the opposite of the real world - it's hard to take illumination into account because there are an infinite number of places that could be contributing to the illumination of a given point. In standard ray-tracing, we simplify the problem by assuming that light comes from a finite number of infinitely small light sources - that way, there are a finite number of places to look for illumination. You may not have noticed that vanilla ray-tracers never model light sources of finite size - you never get soft-edged shadows in ray-traced images. It's the same problem - if your light source has any size, then it's no longer a finite problem. Offhand, I can think of several ways to take general illumination into account. I'm sure they've all been treated in some paper or other - check the handy index that appears yearly in the SIGGRAPH newsletter. * Stochastic sampling (also called distributed, for some reason). We can't send an infinite number of illumination rays out into the world, but if we send out random rays in an intelligent way, we get a good approximation, and the randomness turns any aliasing effects caused by the finite sampling into noise, which is much more pleasant. * Forward ray-tracing. Trace rays starting from all the light sources (note: only point sources allowed!), and see what they hit. You can do this as a preprocessing step - bounce light off mirrors and through lenses, and then record how much light eventually falls on any given surface. This requires an amount of storage equivalent to what it would take to uniquely texture map all surfaces - in fact, you can think of the illumination map as a kind of texture map which is calculated as a function of lighting and mirrors. You actually need to do this stochastically too, because there are an infinite number of places you could send an illumination ray, and if you miss ANY of them, it might show up in the visible image. * Beam tracing. The problem with rays is that they are infinitely skinny, so no finite number of rays can completely sample anything. If you model your rays as actual solid objects - cylinders or prisms or pyramids or some such - you avoid this problem. In reverse ray-tracing, you can send an illumination test ray at a mirror that is big enough to cover the entire mirror; as it bounces off the mirror it will become bigger yet; if it eventually encompasses a light source, you count that as illumination. In forward ray-tracing, you can send a big fat beam out from each light source, and rest assured that it will cover everything that a real light source would cover. Problem: it'll get REALLY hairy as each beam hits or grazes objects, and splits up into large numbers of oddly shaped beams. * Intelligent geometry. Instead of relying on the ray-tracing model to take care of everything for you, you use knowledge about how mirrors and lenses work to handle the problem. For instance, in my example of a sphere and a mirror, when we want to check if any light from the lamp would bounce off the mirror onto a particular point on the sphere, we can solve the equation "find point C such that the bisector of the angle ACB is perpendicular to this mirror." If the C is on the mirror, then there is a reflection, and if not, not. This is fine for flat mirrors, and I'm sure it could be extended for spherical mirrors and lenses and such. For funny shaped mirrors, it would get nasty - either you decompose the mirror into millions of little planes, and carry out the above computation millions of times, or you solve the equation for bicubic patches or something like that. QUESTION: do there exist any papers on the intelligent solution of the reflection or refraction equation for nontrivial primitives like conics or spline patches? The latter would be an account of MIRAGES, and I'm sure I've seen something like that somewhere! Whew! This has been fun to write, and I hope people find it interesting. I would like to correspond with people interested in the above problems. >> Something tells me that all three questions are rather hard. >Nah. They were easy. Just the ANSWERS are hard! :-) - Ranjit This document is Copyright 1988 Ranjit Bhatnagar. Permission to reproduce is granted except under a compilation copyright. "Trespassers w" ranjit@eniac.seas.upenn.edu mailrus!eecae!netnews!eniac!... -- I'm not a drug enforcement agent, but I play one for TV -- Giant SDI lasers burn 1,000 points of light in Willie Horton - Dave Barry
lee@uhccux.uhcc.hawaii.edu (Greg Lee) (12/07/88)
From article <6555@netnews.upenn.edu>, by ranjit@eniac.seas.upenn.edu (Ranjit Bhatnagar):
" chris@spock.ame.arizona.edu (Chris Ott) writes:
" >> [Leo Schwab's questions]
" ... (Where DOES the mirror come in? Consider a ray that
It seems that the mirror is a window into a looking glass world
that may contain some light sources (and eyes?).
Greg, lee@uhccux.uhcc.hawaii.edu