home *** CD-ROM | disk | FTP | other *** search
- ____
- / /
- _________ ____ / /
- | | \ \ / /
- | ,-----' \ \/ /
- | |____ \ /
- 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 always have a saturated intensity peak
- in their very center, even with low values of glow.
-
- - When using non-white light sources (slightly redish, for
- example) the three rgb components won't get saturated at the
- same time, ones will do before others, creating layers of
- rings due to extreme Mach banding. This is a side effect that
- can look actually very cool, accidentally similar to some
- kind of lens flare so common these days. Play with it!
-
- - You can of course use ground fog at the same time you are
- using glowing lights, but if you are worried about
- correctness, yes, there is some kind of conceptual
- incompatibility between both effects as implemented here;
- glowing lights work as if they were inmersed in uniform fog,
- and ground fog lacks uniformity along Y axis, besides being
- designed as illuminated by a directional source as the sun.
- This is a little but worth to note "defect". There's much,
- much more to the accurate simulation of atmospheres than
- these two almost trivial effects. Refer to the research
- literature and you will find how complex things can get.
-
-
-
- 4. DISTRIBUTION SITES
-
- Still looking for them ... I suppose it could be stored in
- ftp.povray.org, perhaps in pub/povray/incoming/unofficial/compiles
- or somewhere like that.
-
- The original POV-Ray 2.2 package can be downloaded (among other
- places) from POV-Ray's own official site: ftp.povray.org, in
- /pub/povray/... (i can't remember the full path). You can also
- access it via www at http://www.povray.org
-
-
-
- 5. MAKING BINARIES
-
- POVAFX is distributed as the modified source code from the official
- POV-Ray 2.2, so to compile an executable you just have to replace
- the old original files with these ones, and proceed normally as
- indicated for your machine. I've distributed a PC/MSDOS executable
- compiled with GNU's GCC (djgpp), which suffers from the same display
- problems as the executable distributed with FTPOV; you must specify
- the correct video card and you are limited to 8 bits per pixel.
-
-
-
- 6. CHANGES TO ORIGINAL POV-RAY 2.2 CODE
-
- These are short descriptions of the changes. Wherever i've modified
- something, i've put near it a comment like this: /* [Marcos] */, so
- searching the string [Marcos] will lead you there.
-
- LIGHTING.C
-
- Enhanced function Fog(). Note that it computes ground fog
- iff height<>0, and now it takes new arguments. Defined some
- macros for improved readability (Lerp, ColorLerp, Clamp).
- Added new function Glowing_Lights(). Modified functions to
- call properly both Fog() and Glowing_Lights().
-
- RENDER.C
-
- Modified functions to call properly both Fog() and
- Glowing_Lights().
-
- POINT.C
-
- Initialization of glow and glow type fields in light sources.
-
- TOKENIZE.C
-
- Added new reserved words: "height", "glow", "glow_type_a"
- and "glow_type_b".
-
- PARSE.C
-
- Initialization of fog height attribute in frame structure.
- Added parsing of all new reserved words.
-
- FRAME.H
-
- Added fog height attribute to frame structure. Added glow
- and glow type attributes to light sources. Defined M_PI_2
- macro (one half pi).
-
- POVPROTO.H
-
- Declaration of new or modified functions.
-
- PARSE.H
-
- Added new tokens: HEIGHT_TOKEN, GLOW_TOKEN, GLOW_TYPE_A_TOKEN
- and GLOW_TYPE_B_TOKEN. Updated LAST_TOKEN.
-
-
-
- 7. CONTACTING THE AUTHOR
-
- I will be very happy hearing from you. Please report any bugs or
- inconvenience you find. I'm also always willing to discuss technical
- details of image synthesis, so if you are on the tech side and
- would like to talk about so many interesting things, just don't
- wait any more and mail me! :-) I have some early tests of some of
- these atmospheric effects in my home page. Check them out.
-
- mfajardo@freenet.hut.fi
- http://www.geopages.com/TimesSquare/2143
-
- You could also find me sometimes in IRC, nicknamed MarcosF or Marcos,
- in channels #3d, #lightwave or somesuch. Sometimes even in #guitar
- (hey, do you know of Eric Johnson? i'm looking for info on him :-)
-
- I also have snail mail at your disposal (yes, you'll need to use
- a piece of paper with stamps... truly antique, isn't it? ;-)
-
- Marcos Fajardo Orellana
- C/. Pico de las Palomas 11 5-I
- 29004 Malaga
- SPAIN
-
-
-
- 8. REFERENCES
-
- If you are interested in the technical issues behind atmospheric
- effects, use [1] and [2] as starting points; you'll find lots of
- references at the end of both of them.
-
- [1] N. L. Max, "Atmospheric Illumination and Shadows", Proc. of
- SIGGRAPH '86, pp 117-124
-
- [2] Nishita, Nakamae, Okamoto, Kaneda, "Photorealistic Image
- Synthesis for Outdoor Scenery under various Atmospheric
- Conditions", The Visual Computer, 7 (1991), pp 247-258
-
- [3] Han-Wen Nienhuys, short note in The Ray Tracing News v7 n3
-
-