Jump to content

  • Log In with Google      Sign In   
  • Create Account

Distance fog and sky


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 larspensjo   Members   -  Reputation: 1538

Like
1Likes
Like

Posted 04 February 2013 - 03:07 AM

My game is set in an outdoor environment with unlimited distances. The viewing distance has to be limited, as usual. Because of that, there is a clear cut-off and some objects blink in and out when moving around. Now I am investigating how to use a distance fog to improve the display, and hide the cut-off.

 

Implementing a fog gradient depending on distance was easy, but the problem is in combination with the sky. It is at a very long distance, and would thus get hidden completely by the fog. However, if I disable the fog gradient for the sky pixels, the far distance horizon does not look good. The distant ground will be completely gray, as expected, but the transition from ground pixel to sky pixel will be abrupt from white to blue. That means that the horizon profile will show clearly, which does not look realistically.

 

As a next step, I added a vertical gradient for the distance fog. Opaqueness going from 1 to 0 from horizontal level up to 20 degrees elevation. This will effectively hide most distant horizon objects behind fog, and still leave some sky above. However, tall buildings and other constructions will still be visible on distance, and suffer the abrupt cut-off.

 

Any suggestions on how to improve the situation with tall buildings?

 

FogOfDistance_2013-02-03.JPG

The picture shows vertical gradient enabled (but not tall objects suffering cut-off).


Current project: Ephenation.
Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/

Sponsor:

#2 Krypt0n   Crossbones+   -  Reputation: 2565

Like
2Likes
Like

Posted 04 February 2013 - 03:51 AM

I think there are two problems:

- usually, if the fog is dense enough to hide objects, it will also hide the sky, so you'll end up with a gray sky above.

- the skybox shows curvature, while your 'earth' is flat/infinite.

 

technically it's better to think of fog as a blend of the scene and the skybox, I'd suggest to do exactly that. use the depth to blend the rendered 3d scene with the skybox in the distance, it will look like objects appear out of the distance fog, yet you'll still have the proper skybox rendered.

 

it's of course a bit fishy if objects appear in-front of clouds, but it might still look ok, otherwise the cloud layer would need to be rendered separately, so 'fog' should just blend to the atmosphere, not the clouds, but obviously, they are embeded in skyboxes usually, 



#3 RobMaddison   Members   -  Reputation: 694

Like
1Likes
Like

Posted 04 February 2013 - 06:08 AM

If your character/camera doesn't move too quickly and you're talking about objects that are a very long way off, you can always render the distant objects' lowest LODs once every x frames to a render target and render that as a billboard. Haven't tried this myself but I've heard of it being done.

#4 larspensjo   Members   -  Reputation: 1538

Like
0Likes
Like

Posted 06 February 2013 - 05:38 AM

use the depth to blend the rendered 3d scene with the skybox in the distance

I see, that looks like the best solution. Thanks!

 

you can always render the distant objects' lowest LODs once every x frames to a render target and render that as a billboard

Thanks for the suggestion, but it doesn't help for an unlimited world. That is, distant objects will still be cut off or suffer blink in and out. But I suppose the LOD in combination with the blending described by Krypt0n can be good.

 

As a next step, I am now looking into how to get the best white color of the fog. The same fog will be visible when being underground in big caves with low viewing distance, in which case the "gray" fog will sometimes be much too bright. The idea I have is to compute an average luminosity of the screen, and use that to set the white point of the fog. Possibly downsampling the luminosity into a few major sections.


Current project: Ephenation.
Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/

#5 Hodgman   Moderators   -  Reputation: 30352

Like
0Likes
Like

Posted 06 February 2013 - 06:26 AM


use the depth to blend the rendered 3d scene with the skybox in the distance

I see, that looks like the best solution. Thanks!


It makes sense, because if you think about it, the sky is just black space but with fog over the top. So fading into the sky, is fading into fog ;)

#6 Norman Barrows   Crossbones+   -  Reputation: 2103

Like
1Likes
Like

Posted 10 February 2013 - 10:32 AM

i would recommend the approach used in Oblivion: LOD models for large distant objects. use object fade in/out at clip range. use just a little fog to smooth things out a bit. in general fog ought to be used as a weather effect, not as a way to hide lack of good LOD modeling of large distant objects (mountains, skyscrapers, etc).if you choose this approach, word is that doing your own LOD is the only way to go. 


Norm Barrows

Rockland Software Productions

"Building PC games since 1988"

 

rocklandsoftware.net

 


#7 larspensjo   Members   -  Reputation: 1538

Like
0Likes
Like

Posted 11 February 2013 - 05:44 AM

LOD models for large distant objects.

That is a technology I am still investigating. I suppose the principle is easy, but not always simple to implement.

  1. My world is voxel based. It is difficult to optimize, leading to a need for near cut-off, or the number of triangles grow quickly.
  2. The world is totally dynamic, so I can't do much offline computations.
  3. The game is client/server. Even if LOD would improve the possible view range, the volume of data requested from the server may grow too much and turn out to be the bottle neck. Local client caching is used to reduce this problem.
  4. One way to implement LOD for a cube based geometry could be to merge a 2x2x2-set of cubes into a single, bigger cube. Technically not hard, but difficult to do seamless. Some kind of mipmap-like technology may be needed, but I don't know how that would be done.
  5. Impostors can be used, and I do that to some extent for trees already. Possibly, they can also be used for bigger chunks of blocks.

Current project: Ephenation.
Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/

#8 Norman Barrows   Crossbones+   -  Reputation: 2103

Like
0Likes
Like

Posted 14 February 2013 - 11:55 AM

LOD models for large distant objects.

That is a technology I am still investigating. I suppose the principle is easy, but not always simple to implement.

  1. My world is voxel based. It is difficult to optimize, leading to a need for near cut-off, or the number of triangles grow quickly.
  2. The world is totally dynamic, so I can't do much offline computations.
  3. The game is client/server. Even if LOD would improve the possible view range, the volume of data requested from the server may grow too much and turn out to be the bottle neck. Local client caching is used to reduce this problem.
  4. One way to implement LOD for a cube based geometry could be to merge a 2x2x2-set of cubes into a single, bigger cube. Technically not hard, but difficult to do seamless. Some kind of mipmap-like technology may be needed, but I don't know how that would be done.
  5. Impostors can be used, and I do that to some extent for trees already. Possibly, they can also be used for bigger chunks of blocks.

 

ok, i see what you're talking about, the WHOLE thing is voxel based. Wow! Lots of triangles there!

 

i take it the world is stored as voxels and converted to triangles for drawing.

 

basically a roll your own version of LOD for voxels analogous to roll you own LOD for meshes would be something like:

the same way that a LOD mesh is simply a low rez version of another mesh, you'd have low rez voxel maps, say as powers of 2 resolution, almost like mipmaps. like you said, you need to come up with a slick way to generate the low rez voxel maps (possibly procedurally from the hi rez ones, yeah i know, realtime deformation, you'd have to recompute every time the land changed). when you draw, you draw with the highest rez map out to a certain distance, then switch to the next highest rez, and draw further out, etc. you might need to come up with some trick to make the cut off between areas of different rez less noticeable  but if you keep those distances kind of far from the camera they may not be too noticeable. and only then use a BIT of fog (not pea soup! <g>) to help hide the cutoff.

 

in the end, it may be that trying to do a triangle intensive deformable voxel system on top of client server will not yield the desired effect on today's hardware (specifically the client server bandwidth bottleneck).

 

networked games really need to be designed entirely around the data packet size. how much info you can transmit per frame determines EVERYTHING, from how deformable the environment can be to how many characters you can have active at once. Selection of all game subsystems (graphics engine type, etc) must be done based on bandwidth requirements of the system above all other considerations.

 

i take it that the normal thing to do in voxels these days its to just draw as much as possible at one resolution  with no LOD.   

 

are there any titles out there that use voxel and some LOD or have the desired look (single player or networked)?

 

IE are there any existing examples of what your shooting for?


Norm Barrows

Rockland Software Productions

"Building PC games since 1988"

 

rocklandsoftware.net

 





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS