• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

Nick Murphy

volumetric fog (FlyFire)

24 posts in this topic

Only idea - i have not tried it yet.
Implement it as vertex fog
F(x, y, z) - integrated by z axis fog function,
for each lighted vertex V.color = alpha*V.color +
(1-alpha)*F(x,y,z). You should render background fog
also... may be render F(x,y,z) into billboard
grid vertices ?
0

Share this post


Link to post
Share on other sites
hmm, i don't know much about this, though i've looked for stuff on it in the past. i guess there
isn't a whole lot out there on the subject. all i can tell you is that i think, if implemented in
realtime, the stencil buffer is used....

-Nick

0

Share this post


Link to post
Share on other sites
I'll have an article on this topic within a week or
two.

The program will use vertex based multi-pass
blending. (Only one pass for the fog, but it can be
layered on top of other passes). I believe this is
how quake3 does it. It's a good solution for decent
quality, flexibility and speed.

The article will discuss a few other ways of doing it.
particle-based
3d-textures

I hope to expand it to more advanced algorithms,

including animated procedural fog.

I'll post something here when I get it done.

Scott Franke [druid-]
sfranke@usc.edu
druid-'s GLJournal

0

Share this post


Link to post
Share on other sites
i'm beginner in this kind of stuff, so i don't know
some of terms. Can you explain what is stencil buffers?
i heard about them, but didn't find any explanation
thanx
0

Share this post


Link to post
Share on other sites
ok, multipass rendering only good for hardware
rendering, but i was talking about software techniques,
like volumetric fog in Unreal.
0

Share this post


Link to post
Share on other sites
It's a second pass with gouroud shaded polygons.
Doubling the number of polygons, but it could be worse.

You'll notice that having fog in scene will slow down
the Unreal engine quite a bit (check the fps on the
opening shot). I'm not sure what technique they used,
but I'm trying to find out.

Nick:
I'm not familiar with any volumetric fog techniques
that use the stencil buffer. Do you have an example
of one?

0

Share this post


Link to post
Share on other sites
Another idea - for fog with cylindrical symmetry
u can precalculate a set of map (it will be one -
parametrical) and between the map use linear
blending; the corresponding (to From ->To vectors) map
applied to object either as second texture or as
quad + stencil (here is a stencil buffer)template.
0

Share this post


Link to post
Share on other sites
Hmm, looks like a good article (i didn't read it yet
due a lack of time )
But anyway, example works veeery slow on my pc (P166MMX
with S3 ViRGE 3D) - only 1-3 frames per second.
0

Share this post


Link to post
Share on other sites
Another idea - for fog with cylindrical symmetry
u can precalculate a set of map (it will be one -
parametrical) and between the map use linear
blending; the corresponding (to From ->To vectors) map
applied to object either as second texture or as
quad + stencil (here is a stencil buffer)template.
0

Share this post


Link to post
Share on other sites
You can try this...

Get the source code, take out the part that renders
the texture (it's bilinear filtered, which is slow as
hell in software). Then try turning down the
tesselation level. It's in the tessBox function -
lines 391-3 in scene.c. It's 8 right now, start at
one and go up if it runs decently.

0

Share this post


Link to post
Share on other sites
Since i don't have VC installed, so i can't recompile
your example. i'll belive your words.

I have read your article. The only thing i can suggest
is to make some kind of terms glossary for the words
like "The actual volumetric fog computations is a _line
integral_ through 3D space, which integrates a _spatial
lighting function_"
or strips and fans.
Some of them is not clear for me (and, i think, other
people too, who just starting to go into 3d secrets and
tricks).

P.S. Doom doesn't use BSP Trees (introduction - line
13) Hope this is just mistake

0

Share this post


Link to post
Share on other sites
Well, I'll consider making those changes myself and
posting a low-end version. I'll also consider putting
together a glossary for my web page with those terms
and any others people ask about. That's a good idea.

Doom does use BSP trees actually. Download the source
and see for yourself. Just because it's a 2d bsp
doesn't mean it's not a bsp.

look at :
r_bsp.c & r_bsp.h

0

Share this post


Link to post
Share on other sites
Hi all,

Yesterday I was thinking about a way to do volumetric fog. And i have some ideas for it.

Most of the time people use 'fog spheres' to do volumetric fog. Because I worked with people who worked very close to the development of Unreal I know that Unreal does fogging also probably using fogspheres.

You need to create a texture (the way Unreal does)and map that on the world with a special blendmode. The texture contains the fogsphere texture and is view dependent. So you have to recalc/upload the texture every time the viewport changes. And since texture uploading on hardware is not really fast this slows down Unreal pretty much. (Unreal's bottleneck were also the enormous texture uploads)

Basicly the intensity of the fog is calculated like this:
density * (fogEnd - fogStart)
If we use a sphere with a constant radius, it is quite simple. It doesnt matter how you view the sphere but it will always result in a texture which is intense in the center and fading to the borders. Like a phongmap sometimes used in fast environment mapping.
Now you need to calculate the density. Maybe you can base that on the distance to the center of the sphere or whatever.

After you created the right texture you will also need to map it on the world. I haven't really thought about this yet. At the moment I'm just thinking about about the generation of the volumetric fogsphere texture.

Well, this were some idea's of me. I hope other people can work this idea out to a working volumetric fog model.

- John van der Burg
Programmer of Oxygen3D http://www.mysticgd.com

0

Share this post


Link to post
Share on other sites
I get your idea about fog-spheres and i think i know how to basicly implement it. Also i found one good looking fog phere in Unreal. But how to be with ground fogging?
For example, fog over a water surface, like in the starting intro in Unreal?
Place many fog spheres? That seems to be very slow and will not looking good.

FlyFire/CodeX
http://codexorg.webjump.com

0

Share this post


Link to post
Share on other sites
Hi !

I can simply answer your question. Spherical Volumetric Fog is done by calculating the distance between two intersection points of a sphere. These intersection points are computed by casting a ray from a vertex to the camera, when the ray hits the sphere you get two (or one if a tangent by the way) intersection points. Calculating the distance is used to calculate the fogging of the vertex.

But this is not the only way to do fogging. Basically as said before everything comes down to calculate two intersection points (where the ray enters and leaves the fog). But you can calculate the two intersectíon points with spheres, boxes, 3D Meshes and so on. Spheres are normally used because calculating intersection points is very easy and quite fast. In order to do ground fog, just use a box which starts and is some value high. That's it. Calculate the intersection points with the box and do the rest the same as with spheres.
You can also do that with 3D Meshes, but then calculating intersection points get's quite slow and complicated.

I don't know if Unreal is able to use different Volumes than spheres, but basically this is a way to do very, very nice ground fog.

I will soon post an article (give me 3 or 4 days) which will very detailed explain, how it works, the basics and how to do it in a program. There will also be Source Code and an executable. It will explain spherical fog, but you will also see a few ideas how to do it with other volumes.

When my article is up, I will post it here.

Bye now,

Phillip Schuster

0

Share this post


Link to post
Share on other sites
I think if we will use spheres, updating lightmaps will be quite fast. Because sphere always result on a polygon highlight in center that fades to borders, we can store initual fog density and then just calculate new one at the center and at the border, and then fade it using simple quadratic equation.
This idea is still not clear for me, but i think this might be fast.

Also, make vertex fog is easy, but how to be with lightmaps fog? (foggin every pixel). At /opengl i found some words about space tesselation, but i didn't get how to do this.

Thanx,
FlyFire
http://codexorg.webjump.com

0

Share this post


Link to post
Share on other sites
In the little volumetric fog article I wrote a while back, I used axis aligned boxes (not neccessarily square). This makes calculating the intersection trivial. My density calculations treat the box as it if was an ellipsoid (linear or quadratic fall-off along each axis from the center).

Don't feel restricted to using only spheres for your fog volumes. You can generalize the intersection algorithm to work with ellipsoids fairly easily.

------------------
Scott Franke [druid-]
sfranke@usc.edu
druid-'s GL Journal
http://www.gamedev.net/opengl

0

Share this post


Link to post
Share on other sites

Not that its any of my business, but why is Nick talking to himself at the top of the article, it is very confusing to decipher what he is trying to say.
0

Share this post


Link to post
Share on other sites
True volumetric fog involves solving the line integral between the camera and the surface on which you want the fog projected. The line integral is essentially a sum of the density of the fog over a large number of tiny steps which, taken as a whole, add up to the distance from the camera to the surface.

Volumetric fog can be approximated by calculating the fog color at each vertex of the tris over which the fog will be projected and interpolating the values in between vertices. OpenGL has an extension to specify fog colors for a vertex (much like texture coordinates).

For those mathematically inclined, the line integral is much like integrating f(x)dx, except dx is now a vector and x is a point in space. Or something like that. This stuff is usually covered in an advanced calculus course in college.

0

Share this post


Link to post
Share on other sites
Hi !!

I have an example and a very (64 KB) article about volumetric fog done a few days ago.

Go to www.voodoospotlight.com/devknowledge/index.html

There you will find the article, an executable showing my algo and full source-code. You will need Power Render to recompile, however it's understandable even if you never heard about Power Render before.

Just check it out. I got a lot of positive feedback on my article. I think all answers here are covered in my article.

Phillip Schuster

0

Share this post


Link to post
Share on other sites