Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 


Submitted by Daniel Hein, posted on February 15, 2001




Image Description, by Daniel Hein



These Pics are just some shots from my Portal Engine-in-progress. All these shots show some Lighting + Volumetric Fog tests. The upperleft shot shows a Red, Green, and Blue light, as well as a Blue fog volume in the background. The Cube is a Rigid Body spinning back and forth across the room. I do have Volumetric shadows, but at the moment they slow it down quite alot, so they are disabled for these pictures. The lower left shot is a closer look at the Blue fog volume, being lit by the pinky/red light above it. The 2 shots on the right are of a red Fog volume being lit by a green light. The upper one is from above the volume, and the lower one is from inside the volume. I'm trying to improve on the realsim though.

What these still shots cannot show you is that the world geometry is deformable, and the fog volumes are as well. i.e., walking through the fog will leave a disturbed trail behind you...Doesn't work 100% yet, but it's getting there :)


[prev]
Image of the Day Gallery
www.flipcode.com

[next]

 
Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Pants

February 15, 2001, 11:32 AM

Apart from the fact that you need textures, that looks real good. I expecially like the fact that you can light the fog. How is it done?

Pete

 
Hannu K.

February 15, 2001, 11:46 AM

yup that lower left picture looks good :)

 
valery Carpentier

February 15, 2001, 12:37 PM

>I expecially like the fact that you can light the fog. How is it >done?

I'd guess that as you have to do a second pass for the volumetric fog, you might as well light the polys you're rendering. It's easy but it's a very smart idea (and it looks brilliant)

 
David Morton

February 15, 2001, 01:01 PM

>> the world geometry is deformable

I'm trying to implement deformable geometry too using a vox space approach. If you don't mind sharing, what are you using?

Dave

 
James Matthews

February 15, 2001, 02:22 PM

The fact that the fog deforms sounds really impressive...looking forward to some more of your IOTDs once you get that working. I'm also looking forward to Red Faction for the PS2 and PC that uses deformable geometry (not for fog...but anyway) - great stuff :)

James.

 
Kallen McInerney

February 15, 2001, 02:38 PM

I'm interested in how volumetric fog is performed...does anyone have a good link? Daniel could you give a quick-n-dirty overview of how you do yours?

Thanks
Kallen

 
Waramp

February 15, 2001, 09:42 PM


Thanx for the kind words all :)

To answer some questions:

About the Deformability:
At www.gamasutra.com there is an article about 2D surface deformation. All my walls are made up of these surfaces. When you set the elasticity to 0, the will not reform, and thus can be punched around quite a bit :)
(Altho by changing the damping and elasticity values, I can have the walls act like rubber, water, or almost any other substance)

About the Fog:
The fog is essentially raytraced per vertex at run time. Each vertex in the fog is given a color, determined by the color of the fog, and by whatever lights are effecting the scene. The lighting is done when the level is loaded, so that all the colors at each vertex are pre-calc'd. A ray is cast from the eye to each vertex, and an Alpha value for that vertex is determined from that distance. Because the fog doesn't move around alot when you move thru it, it still looks ok with the static lighting.

What I am working on right now is a way to get the lit fog to look a little more realistic. For example, in the lower right pic, I dont think you should be able to see that bit of red in the lower middle of the green part. But those are just details :)

-Daniel Hein

 
Tim Auld

February 15, 2001, 11:34 PM

The fog looks very effective, but I have a question about your explanation of the implementation. You say that you cast a ray from the eye to each vertex, and use the distance to determine the alpha. If it's just distance (from the camera) based, is it actually casting a ray? Wouldn't you get really dense looking fog if it's a long distance away? Imagine a thin wall of fog: from a distance the wall of fog would be opaque, but fade as you get closer. Or do you mean that you cast a ray into the fog volume and calculate the length that the ray exists in the volume (which would make convex only volumes nice). If this is what you are doing your explanation wasn't very clear :)

In either case, what is the mapping between distance and alpha - is it linear or something else?

To remove that red artifact, perhaps you could integrate over a number of discrete points lit at run-time within the volume, instead of just on the colour of the target vertex?

I guess that the volumes are tessellated somehow in order to allow the lit fog to have some resolution? Is this tessellation done at run-time or just part of the volume mesh? If it was done at run-time could it be done to produce vertices more at points of contrast?

Is the visibility of the fog volumes tied to the visibility of the cell that they lie in?

I find this very interesting - I might have to put something into my own portal/bsp engine to support volumetric fog!

 
Frans Bouma

February 16, 2001, 04:33 AM

Volumetric fog example (openGL):
http://www.gamedev.net/opengl

 
Waramp

February 16, 2001, 04:43 AM

Tim: Yes, after reading my blurb i realize I wasn't very clear :)

The Alpha value is based on the distance within the volume. Sorry about that :)
And yes, only convex hulls are used. This is done for speed considerations. The Value I use is the Distance*Fog Density*Scale Factor (which in my case is 0.4), so it's linear.

As for getting rid of some artifacts, Im working on that at the moment. I have several ideas I want to try.

The volumes are all tesselated when the map is loaded. I suppose i could tesselate more around the lit area boundaries..I haden't actually thought of that. The fog cell visiblitity is tied to the sector it resides in. In my engine, Fog, Fluid, and Light volumes are "Accessories" to the sectors they reside in. Thus if the sector isn't visible, neither are any of the other things. Because I tesselate the fog volumes, I can cull individual triangles from the frustum as well, but I am currently at odds as to whether or not that is worth doing. Is the extra culling time actually profitable compared to the time it takes to draw the hidden triangle...Im not too sure.

To everybody:
Feel free to email me if you want to swap Ideas or whatnot.

-Daniel Hein

 
cfrog

February 16, 2001, 06:09 AM

Nice shots ! would be cool to see the fog in realtime.
One question: How do you create the cells/portals ?

 
defor

February 16, 2001, 06:22 AM

Daniel,
I'm not quite sure whether i understand it right. Is your fog volume/object made of some kind of 3D mesh (in a perfect case a cube)?
How many polygons it consist of in that case then?
And also, you mentioned that the fog volume is deformable and walking through leaves a trail. Do you apply some geometric distortions to
vertices of that 3D mesh to perform it? Do you use some 'turbulence' equations for that purpose?

I'm sorry for my 'stupid' questions. I've never coded anything like this.

defor

 
booneo

February 16, 2001, 12:58 PM

Volumetric fog, blah... whatever - it's just a primitive or something in OGL... not a big deal.

However, what is this about being able to leave 'fog trails'? That sounds like something really interesting.

 
Jesse

February 16, 2001, 01:00 PM

 
Jrz

February 16, 2001, 01:12 PM

You obviously have no idea what volumetric fog is, what the standard fogging does, how it works and all

 
Peter Mackay

February 16, 2001, 01:23 PM

booneo:

Okay, volumetric fog is NOT just a primative you can add. If it was that trivial, we'd see it a lot more. Before you dismiss this kind of thing, please read up on what it is.

(Let the flames begin!)

- Peter

 
NinjaCross

February 16, 2001, 02:27 PM

So... i learned OGL's main features one year ago, and i passed all this year on OGL programming, every day, that's my work.
I can say that this screen shoot is really nice, and Daniel have done a good work.
I'm sure that out there there are a lot of very skilled (more than me, i'm sure) programmers that can agree with my sentence.
(I hope that BOONEO will understand that it's important to have experience, if he wants to judge other's work, cause it's clear that he haven't got it).

 
flure

February 16, 2001, 02:40 PM

yes, opengl fog is really easy to use, but it's really ugly compared to Daniel's one, and moreover opengl fog is based only on the distance from the viewer, so it's not volumetric at all !!

so congrats for daniel's work ...

 
Waramp

February 16, 2001, 02:41 PM

Yes, the volume is made of a mesh. The mesh is tesselated when the map is loaded to give a particular resolution, say 2 or 3 vertices per unit. (In my case, 1 unit = 1 meter). Because of that, the larger fog volumes use more vertices, so you do need to use some discretion when created them.

The distortion is possible because I compose most of my world out of
these wonderful things: http://www.gamasutra.com/features/20000216/deformation_01.htm

So The thing that's moving through the fog is merely an effector applying a force to the vertices.

I hope that answered your questions.

-Daniel Hein

 
Elixir

February 16, 2001, 11:10 PM

A while ago druid- from druid-'s GL Journal made a great article on how volumetric fog can be done (technically its ray casted fog maps). Even has a nice demo to go along with it =P
It can be found at:
http://www.gamedev.net/opengl/volfog.html

 
Waramp

February 17, 2001, 01:23 AM

Being that it's a portal engine, the Cells / Portals are the primitives that a level is composed of.

Look at the portal engine series here at flipcode...

-Daniel Hein

 
cfrog

February 17, 2001, 03:55 PM

I haven't found any tutorial that describes the actual process of creating the cells/portals. I've allready made my own cell/portal/pvs generator but it would be nice to exchange ideas with someone else.

 
This thread contains 22 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.