home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
f
/
ftpov
/
Authors
/
POVAFX10
< prev
next >
Wrap
Text File
|
1995-12-18
|
14KB
|
302 lines
____
/ /
_________ ____ / /
| | \ \ / /
| ,-----' \ \/ /
| |____ \ /
POVA| | \ /
| ,----' / \
| | / \
| | / /\ \
|___| / / \___\
/ /
/ / POVAFX v1.0 extensions
/ / POV-Ray with Simple Atmospheric Effects
/ /
/ / Marcos Fajardo
/ / mfajardo@freenet.hut.fi
/ / http://www.geopages.com/TimesSquare/2143
/___/
0. INDEX
0. INDEX
1. WHAT'S THIS?
2. WELL, WHAT ARE EXACTLY THOSE FX?
3. TRICKS AND TIPS
4. DISTRIBUTION SITES
5. MAKING BINARIES
6. CHANGES TO ORIGINAL POV-RAY 2.2 CODE
7. CONTACTING THE AUTHOR
8. REFERENCES
1. WHAT'S THIS?
POVAFX is a custom unofficial version of the POV-Ray ray tracer that
is able to render some simple light-atmosphere interactions. This
first release comes with two such effects, namely ground fog and
glowing lights. A few new reserved words have been added to the
parser in order to accomodate smoothly these extensions. Of course,
being this just a little extension to POV-Ray 2.2 code, there aren't
any compatibility problems with POV-Ray scenes. It will behave
exactly as an official POV-Ray does, but with the added functionality
of a couple of new switcheable features.
I've decided to make these simple but useful enhancements public,
since i know of a lot of people who would like them, and it's been
very few work (it was already coded in my own realistic rendering
engine, the only issue here was poking around with POV-Ray's code).
People out there is very bored waiting for POV-Ray 3.0 to come; it's
taking it slowly, so these little and simple goodies may be welcome
by some of you. If POV-Ray 3.0 gets released inmediately after this
POVAFX v1.0 release, most likely i'll have made an stupidity, since
POVAFX v1.0 WILL UNDOUBTEDLY AND SOON BE FORGOTTEN. I'm a fool, i
know... i should have made this 6 months ago, not now... it's just
too late to complain about it. At least i've had fun hacking POV's
code! :-) And if people out there shows some interest in POVAFX v1.0
i could add some more effects like foggy spotlights with fast volume
shadows (Z-buffering from the lights...) or whatever they suggest.
2. WELL, WHAT ARE EXACTLY THOSE FX?
Ground fog
This is an enhancement to POV-Ray's uniform fog feature.
Now fog density vanishes exponentially along the positive Y
axis, due to the factor exp(-y/height). At y=0 density is
100% its full value, at y=height it's 37%, at y=4*height it's
2% and finally it becomes 0% at y=infinite. Thus the fog
statement has been extended with a new keyword:
fog { color SkyBlue distance 200 height 50 }
If height is omitted, you get standard fog. Just remember
that 'distance' controls the fog strength and 'height'
controls its decrease rate along Y axis. Please note that
when using ground fog, there is no fog at all in the range
y<0, so you'll see a discontinuity if your ground plane is
below y=0.
Glowing lights
Traditional point light sources are invisible by themselves,
they serve just as illuminators of object surfaces. You
just can't see a point. That holds correct only in a clear
pristine atmosphere, otherwise every ray would transport some
amount of scattered energy coming from the atmosphere itself
in the ray direction. Rays passing near the light source
would gather more energy because light emanating from it is
attenuated by the distance. That's exactly the phenomenom
that POVAFX inexactly models with its glowing lights. And
what is the visible effect of this whole story? The answer
is simple: point light sources become visible, surrounded by
a subtle (or wild if you want) halo. This is managed via
three additional keywords pertaining to POV-Ray's point
sources: glow, glow_type_a and glow_type_b. Example:
light_source {
<0, 5, 0>
color White
glow 0.2
glow_type_b
}
The glow parameter tells about the local fog density that
will be used in the computations involving this light source,
and it controls how strong the halo will be. It would have
been more correct using the same fog density for all light
sources, but this way allows more flexibility, and you can
always use the same glow value for all of your lights. The
glow type refers to the function used to attenuate light.
Type A uses 1/d^2, with 'd' being distance to the source,
which has been the standard for atmospheric scattering due
to point light sources in computer graphics because of the
simplicity of the integral involved (see [1] and [3]). Type
B, fruit of my own research, uses a similar but definitely
not the same function: 1/(d^2+1). As is not the case with
type A, halos of type B don't get always wildly saturated
in their center. Anyhow, both glow types are physically
inaccurate, because a more accurate model makes an analytical
solution very difficult to find (or impossible at all).
Default model is A.
3. TRICKS AND TIPS
- Ground fog was implemented to be visible only in y>0, so the
usual way of using it is with a ground plane at y=0. If you
position the camera at y=0 you'll clearly see the
discontinuity in the fog.
- Try negative values in the light intensity like this:
light_source {
<1 2 3>
color red -0.3 green -0.3 blue -0.3
glow 0.2
}
You've effectively created a black hole! or in other words,
a visible light sucker, a darkness source ... Glassner called
them darklights in Graphics Gems III. If you put positive
light but negative glow, the result is similar, since you
can see the source as an obscure spot, but objects will be
normally illuminated. Think of it, it's tons of fun.
- Subtle ground fog (high distance, high height) always
improves outdoor scenes, being a simple alternative for
gradient textured sky spheres.
- Use low values of glow to avoid excessive saturation near
the lights, but feel free to turn it up when you want extreme
effects like explosions devouring cities and the like.
Remember that glow type B is less prone to saturation, and
that lights of type A a