how to make far objects fading out ?

my idea is that i could set the blendfunc to something that in combination with fog will make everything disappear if it is far away… is this possible ?

Sure. You can make the alpha values of a geometry be dependant of lod distance. I use fading between lod levels as well and its really a good way to be able to have much higher level of optimization on your geometry. The eye is less sensitive to faded objects than changes of polycounts in optimized geometry.

Fine details like trees and buildings can be switched in much nearer the viewer without disturbing the eye, when you are using blended transparencies.

omg…
OMG !!!
happy

Woah there, you’re talking about using the alpha of the fog to dictate the interpolation between low and high res models?
I’ve thought about this myself.
My thinking was this:-
Every model has, say, 4 levels of detail.
You define 4 zones, corresponding to distance from viewpoint, in your app. Then you define 3 overlap zones, which define an area of overlap between zones 1&2, 2&3, and 3&4.

During your frustum culling stage, you ascertain each models squared distance from the viewpoint (this is free with sphere frustum culling).

From this distance value, you can work out which of the 7 zones (4 main zones, +3 overlap zones) the model is currently in (relative to the viewpoint).

If the model is in the 4 main zones, then you render it at the corresponding LOD, with no blending or fog required.
If the model is in one of the 3 overlap zones, then you enable a fog range, and alpha blending, then render the lower LOD version of the model, then invert the blend function, and render the higher LOD version of the model.

That would work, wouldn’t it? It all depends on getting the fog range to lerp between the 2 LODs properly.

Hi.

Possibly one of the best ways should be to generate mipmaps with successive decreasing alpha, and use trilinear… I think there is an option on the nvidia .dds export tool for photoshop…

See you.

got a problem : i’m using glcolor4f(r,g,b,a) before i draw my level which seems to affect my fog-fading.

any way to disable this ?

btw. how are you doing this ? i tried to set the fogcolor to 0,0,0,1 and the blendfunc to gl_one_minus_src_alpha,gl_src_alpha

this should be correct -> the nearest object has an alpha-value of 0 -> one minus src alpha is 1, so its drawn 100%
the farest object -> alpha is 1 -> drawn one minus 1 -> 0

[This message has been edited by HamsterofDeath (edited 03-19-2003).]

If the model is in the 4 main zones, then you render it at the corresponding LOD, with no blending or fog required.
If the model is in one of the 3 overlap zones, then you enable a fog range, and alpha blending, then render the lower LOD version of the model, then invert the blend function, and render the higher LOD version of the model.

So, you want to render both LOD1 and LOD2 (the highest 2) at the same time? Do you really want your graphics to go slower if an object is farther away? You can really only get away with this if you can afford to make LOD’s 1 & 2 render simultaneously at full-speed. And, if you could do that, I’d argue that your LOD 1 needs more polys/effects.

I think these guys are talking about objects like trees, cars and such. If you can’t afford to draw an object with both lod 1 and lod 2 at the same time, what on earth are you going to do if the unlucky viewer happens to stand below two trees?! The need for lod here comes from the fact that you may have to draw several thousands of them each frame.

Fading between different lod levels (based on fog if you prefer) is a well known and pretty good way to remove popping from lod changes. Actually it’s the only general way I’m aware of.

-Ilkka

Jorge,

Using MIP mapping won’t work, because a thing that’s very near may still render with a low-detail MIP map if you view it at an acute (glancing) angle.

Others,

The latest issue of Game Developer has Jon Blow talking a bit about using alpha to transition between LODs with minimized popping. I’m not sure I agree with everything he says, but it’s worth a read. For example, he claims setting up meshes so they always render correctly for transparency would be slow – as far as I know, it can be done as a pre-process sorting step, assuming there are no intersecting triangles in the mesh. (Coplanar are OK)

If I am reading all this correctly, the poster is attempting to to use glFog to set the alpha of the object he is fading. This won’t work, because fog only operates on the RGB channels. You need to compute the fade value elsewhere.

-Evan

I remember now, that’s why I gave up.
Why does fog have this limitation?
MSDN says that fog colour is a 4 component value, rgba, so why specify an alpha value if it’s ignored?

I think these guys are talking about objects like trees, cars and such. If you can’t afford to draw an object with both lod 1 and lod 2 at the same time, what on earth are you going to do if the unlucky viewer happens to stand below two trees?! The need for lod here comes from the fact that you may have to draw several thousands of them each frame.

Then simply take my example to the extreme. Can you afford to draw both LOD1 and LOD2 of several thousands of objects and still hold your framerate? Not to mention the performance penalty for alpha-blending them, namely proper sorting. Since the whole reason for the blending is to reduce poping, you have to back-to-front sort these things, or you’ll see a problem around the “bulging” edges of the bulging LOD. If the LOD’s don’t bulge, why are you having problems with popping?

If you can afford this cost, I’d still argue that your LOD1 isn’t detailed enough, or you aren’t drawing enough trees/etc.

From my experience I can use much less geometry in my LOD level when using transparency merging than without. I still gain from using transparency LODs + less geometry than high definition LODs.

No matter how detailed LODs you have you will still se popping as light normals change etc. This is substancially reduced when using transparency…