Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hey guys, I'm currently using JME3 to learn 3d game development in java, and I have run into a situation. I would like to add fog effects to my games, but I don't even know where to start to implement this. I know how to set the camera's far frustum to limit the render distance, but that just simply makes a sharp cutoff. I'd like the fog it up a bit to make it feel more natural.

I'm looking for an answer that points me into the correct direction. I'm not looking for specific code snippets or even JME3's engine specifics. I just want to get an idea of how this stuff works in general.


share|improve this question

One tip for choosing the color of your fog. Assuming you are using a skybox, make the fog color be the average color of your skybox on the horizon. If you do this, then as items slowly "fog out" as they become farther away, they will blend nicely into the skybox until they fade away. If you just set your fog color to white and the skybox is not white, you'll end up with white silhouettes of objects, which looks wrong.

share|improve this answer
Great tip, thanks! – Dream Lane Feb 11 '11 at 19:12

In general fog is very simple. It just takes depth of each fragment / pixel and according to some function sets the output color (blends between original fragment color and fog color according to fragment depht). You can use linear blending or quadratic blending or whatever you want (if you implement it yourself).

I'm not java programmer so I can't say you exact commands. But in OpenGL it's very simple and in original rendering pipeline (non-programmable) it can be just enabled by one command and disabled by other. In programmable pipeline you have to write it in your shaders, but it's only blending.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.