Volumetric Phear

C53b386a893da037739d159e4e40b8ef
0
eyebex 101 Jul 30, 2005 at 08:05

05-07-30.jpg

Description
While originally striving to archive another effect (the famous “moving light source behind black letters” thing, making them visible by blending over the edges), I came up with this sphere which simulates light emitting from its center through holes on its surface. I was somewhat inspired by The Dome logo (a German Pop Music event) and Phear, a Teris clone.

The effect itself is not that complex, but as it turned out I had to face some unexpected issues. First of all, I had to learn it is not trivial to place equally spaced points (the centers of those discs) on the surface of a sphere. I read quite some web sites and Usenet posts, beginning from “Tesselating Geospheres” to “An Introduction to Generalized Spiral Points” until I came up with a solution that calculates Coulomb energies for a potential field.

Secondly, as you can see, the sphere is basically black and opaque (yeah, with those white discs). As I wanted the user to also see the light contributed by rays that face away from the user, I had to split the sphere into hemispheres, use the stencil buffer to render only the corona of the back-facing hemisphere, and then the whole front-facing hemisphere in a second pass, all with additive blending enabled.

You may download the Windows / OpenGL executable from my website. The C++ source code is included and requires my recently published GALE OpenGL framework to compile (I was using MS VC++ .NET 2003).

Have fun!

8 Replies

Please log in or register to post a reply.

Fdbdc4176840d77fe6a8deca457595ab
0
dk 158 Jul 30, 2005 at 18:35

Looks great! Thanks for sharing it.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Jul 30, 2005 at 18:54

Nifty. Runs very slow on my machine, though (ATI Radeon 9600)

C53b386a893da037739d159e4e40b8ef
0
eyebex 101 Jul 31, 2005 at 05:12

Yeah, it’s not optimized for speed at all … however, it should run smoothly on a 9600. But then again I remember having some issues on ATI cards (I recently changed my 9800 Pro for a 6800 GT), ATI seems to have some problems with display lists (which I use instead of Vertex Buffer Objects for simplicity). Are you using the latest drivers? I bet it runs smoothly on a comparable NVIDIA card … :dry:

4c85bbf0fe52dd82315ff56c8797ef91
0
Blaxill 101 Jul 31, 2005 at 09:17

I really like the effect, it looks cool. Run smooth on my machine ( x800xt PE :D )

F3ff2088fe22d64396b949f149628107
0
SpreeTree 101 Jul 31, 2005 at 18:24

Very nice effect, I havn’t had a look through the source code yet, but does it use any kind of shader technology?

Would it be possible to alter the effect slightly? I downloaded your solar system demo, and wondered maybe if the effect could be used to render some kind of glow effect around the sun, without resorting to shaders?

Reason I ask is that my current project deals with rendering sun’s and various planet systems, and I am hoping to aim it as pre-shader technology. This might give it a little bit of a visual kick…

Spree

C53b386a893da037739d159e4e40b8ef
0
eyebex 101 Aug 01, 2005 at 04:24

@SpreeTree

Very nice effect, I havn’t had a look through the source code yet, but does it use any kind of shader technology?

It’s all done using texturing and additive blending, so no shaders.
@SpreeTree

Would it be possible to alter the effect slightly? I downloaded your solar system demo, and wondered maybe if the effect could be used to render some kind of glow effect around the sun, without resorting to shaders?

Thanks for looking at my other stuff, too! Of course is possible to use this technique to simulate the sun’s corona. However, I think I would use a different geometry for that. In the above effect, each disc is a light source and is modeled as a cone. As the sun emits light all over its surface, one maybe should use a whole different approach and render several screen aligned concentric discs with a fan-like pattern over the sun.

22b3033832c5c699c856814b0cf80cb1
0
bladder 101 Aug 01, 2005 at 08:00

Sweet effect - looks great. Ran perfetly.

48d5487f357fbcacc89e84720577f0ac
0
Steven_Hansen 101 Aug 01, 2005 at 19:08

That is pretty sweet. Runs great on my development machine (X800 Pro AGP).