Fog Enhancements

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
Robomaniac
Hobgoblin
Posts: 508
Joined: Tue Feb 03, 2004 6:39 am

Fog Enhancements

Post by Robomaniac »

Hey, I was wondering whether these things could be done to enhance the in engine fog (or whether I can just use pixel shaders for them)

1) Height Volume Fog. Basically, Create a fog volume starting at this height and ending at this one (if not, this one should be a quick enhancement to the setFog function (just 2 more params and an enum)

2) Fogmapping. I know this isn't implemented yet, so I'm going to try at some point (b4 december and once i get multiplayer basically up)

3) Varying Fog Density. I'm 75% sure this isn't in. But if it is, yay, if not, i will try to implement it.

I will try my best to implement these things at some point
phear hingo

My Webpage
User avatar
Antiarc
Greenskin
Posts: 120
Joined: Thu Jan 23, 2003 8:40 am
Contact:

Post by Antiarc »

I believe that fog as it stands is how it is in the various rendersystems - that is, there isn't any inherent support for anything beyond the basic fog in the APIs. However, you can implement special fogging with shaders easily enough. NVidia's shader browser has an example of height fog.
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Post by Kencho »

I know some old ATI cards had extensions for height-dependant fog (I assume modern cards already have). If they could be used from render systems, that would be pretty easy to implement. But portability is the problem here :(
Image
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Fog is a per-vertex or per-pixel effect, APIs only typically support simple range-based fog but it's usually per-pixel in most cards which makes it look quite nice. To go beyond that per-vertex you either need to use vertex colours (for cards with no vertex shader support), or vertex shaders, but you'd better make sure your tesselation is pretty good. The best approach is pixel shaders of course, and for that you can use things like the perlin noise volume used in the Fresnel shader to give the impression of billowing, variable density fog.
User avatar
Robomaniac
Hobgoblin
Posts: 508
Joined: Tue Feb 03, 2004 6:39 am

Post by Robomaniac »

Ok, i've been trying to do stuff w/ shaders and since this kinda relates, i'm gonna go ot a bit and post it here. Ok, for example, i'm trying to implement a water caustics effect into the game (i already dl'ed a shader) and i'm confused about which materials to apply it to. The ocean water, the ocean floor? something else? Same goes for fog. I'm just having some conceptual issues w/ what to apply where :\
phear hingo

My Webpage
User avatar
Antiarc
Greenskin
Posts: 120
Joined: Thu Jan 23, 2003 8:40 am
Contact:

Post by Antiarc »

For the caustics, you'd apply it to the ocean floor. A shader doesn't "modify light" (the water), it just modifies the vertexes and pixels of the object you apply it to.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

I am preparing to implement half-space pixel fog in Ogre.
I found a simple shader and a demo which uses a pixelbuffer of some sort.
Can I use the pixelbuffer in Ogre - how do I render it?
There is no material to apply either, so I might have a problem telling Ogre to use this shader? All I want (for now) is some simple pixel fog done in hardware. Can I manually load and run a shader via the cg plugin?
Or should I really have to wait on some kind person doing a fog demo in Ogre? :)

[edit]
I am raising this question here, because it is directly related to robomaniacs questions.
I searched for it - and realised that it's under feature requests ..
[/edit]
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

It looks like I can utilize the pixel buffer code from the dyntex demo, and let the shader do what julia.h does.
I have some trouble understanding how to get that shader in here...
Is it possible to construct a material (with a program) from my manually created image?
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

I think that what I am really asking here is:

How do I create new things using a shader?
If I create a material, using a program, utilising a fog.tga texture - how do I create something using shaders?
I have no trouble understanding how to attach materials with shaders to meshes, but I want my shader to create decals, billboards, pixels, vertices.
I looks so damn easy in OpenGL code, using shaders - Ogre is a different beast. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Post Reply