Author Topic: What is fog mode?  (Read 1163 times)

ChupaReaper

  • Guest
What is fog mode?
« on: 13 July 2010, 15:01:21 »
I use mode="2" for fog, what are the other modes?
Here's the wiki entry:
Quote
<fog enabled="true" mode="2" density="0.03" color-red="0.6" color-green="1" color-blue="0.4"/> Enable fog (as in main menu); fog density (more=harder to see through it); colours of fog (range 0-1); mode= (???)
« Last Edit: 14 July 2010, 11:51:52 by ChupaReaper »

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: What is fog mode?
« Reply #1 on: 14 July 2010, 02:39:24 »
... I don't know... This is the only mention of it in the source, other than to get it from the INI.
Code: [Select]
if(tileset->getFog()){
   glEnable(GL_FOG);
   if(tileset->getFogMode()==fmExp){
      glFogi(GL_FOG_MODE, GL_EXP);
   }
   else{
      glFogi(GL_FOG_MODE, GL_EXP2);
   }
}
Unfortunately, I don't really understand it, but hopefully someone with more experience than me can...
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: What is fog mode?
« Reply #2 on: 14 July 2010, 04:00:11 »
It seems like it's different ways to calculate the fog blending.

GL_FOG_MODE - This parameter can be GL_LINEAR, GL_EXP, GL_EXP2, specifying which equation is used to calculate the blend factor.

See the website for the equations.

Only GL_EXP, GL_EXP2 are possible in Glest with values 0 and 1 respectively, defaulting to GL_EXP2 for any other number. I'm not sure why GL_LINEAR has been left out.
« Last Edit: 14 July 2010, 04:06:14 by hailstone »
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

ChupaReaper

  • Guest
Re: What is fog mode?
« Reply #3 on: 14 July 2010, 11:51:04 »
I found this:
GL_EXP - Basic rendered fog which fogs out all of the screen. It doesn't give much of a fog effect, but gets the job done on older PC's.
GL_EXP2 - Is the next step up from GL_EXP. This will fog out all of the screen, however it will give more depth to the scene.
GL_LINEAR - This is the best fog rendering mode. Objects fade in and out of the fog much better.
From here.

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: What is fog mode?
« Reply #4 on: 14 July 2010, 12:45:06 »
While that is a good site (and where our freetype font code came from), that info on fog just seems wrong.

Linear is just that, a linear equation, not very realistic and unlikely to give better results than an exponential function... I'd suggest it was left out of Glest because it isn't very good  :P

NB: I'm no expert on this stuff, maybe despite its simplicity it is best... but I doubt it.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: What is fog mode?
« Reply #5 on: 19 July 2010, 22:56:37 »
Ok, but then where does the values for the XML come from. ie: the XML's mode is simply "2". Is this GL_EXP2?
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: What is fog mode?
« Reply #6 on: 20 July 2010, 03:05:24 »
in tileset.h:
Code: [Select]
enum FogMode{
fmExp,
fmExp2
};

tileset->getFogMode() is compared with fmExp which is an enumration with the value 0. If it is 0 then it calls glFogi(GL_FOG_MODE, GL_EXP); . If it isn't 0 then it calls glFogi(GL_FOG_MODE, GL_EXP2);

So to answer the question, 2 is GL_EXP2.
« Last Edit: 20 July 2010, 03:06:56 by hailstone »
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

 

anything