ofxFog

Hi! I made this little addon https://github.com/kalwalt/ofxFog to add fog in a OF app. please test it if you find some bug and/or to sugggest some improvement. How sound to add ofFog to the core lib of OpenFrameworks?

nice, thanks for that, i am not zusing this directly but all the commands were really helpful!!

one problem thought: does the fog_mode 2, i.e. linear, work for you? If I use the linear mode, nothing happens, everything works with 0 and 1 but that would be too much fog directly in front of the camera.

also, do you know where the fog gets the coordinates of the camera? maybe that is the problem…

hi kirillis, nice that you find useful this addon!
but what kind of issue exactly do you receive? Do you experience this with the example with the GLSL code?
Anyway linear fog works for me but not sure that it works properly.
i used as reference these pages from oZone3D : http://www.ozone3d.net/tutorials/glsl-fog/index.php there is also the code if i remember right there were two version one for Nvidia and the other for ATI-Nvidia video card.

also, do you know where the fog gets the coordinates of the camera? maybe that is the problem…

from the article above they says:

At the GLSL level, there exists an uniform variable gl_FogCoord. This variable contains the camera-vertex distance value and this value is valid only if, in OpenGL, we have used the following line in the fog initialization :

glFogi(GL_FOG_COORD_SRC, GL_FOG_COORDINATE);
On its side, Demoniak3D initializes the fog with :

glFogi(GL_FOG_COORD_SRC, GL_FRAGMENT_DEPTH);
This means that gl_FogCoord is not initialized and that the distance computation, at the fixed pipeline level, is not done in each vertex but in each pixel. It’s the aim of the second shader .

the GLSL example shows the exponential2 method but i think when you choose the others method from the Gui will not works properly. So i think need to be improved. It is possible to set different method(exp, exp2 or linear) to different color(R,G B) channel to improve the realism. This would be a nice example i think.
Also consider that i opened an issue in github : https://github.com/openframeworks/openFrameworks/issues/1797 proposing it in the OF core lib.