> 1. You forget the fact that in the end this all gets applied to faces > (triangles), and a point inside the triangle will have a value > interpolated > between the values of the three corners. I don't think that's a linear > function anymore.
Then the fragment shader would never get correctly interpolated distances as these are linear (?!) > 2. Afaik light scattering and in the end fog isn't a linear function, so > you > get wrong results anytime an edge length is close to the value of the > visibility distance. Yes - which is why I left the non-linear fog function in the fragment shader and moved the linear geometry computations into the vertex shader. > You can pass any precomputed value from the property tree as an uniform > just > as you're doing with ground-visibility-m. > Remember, an uniform has the same value for all vertices in the mesh, > and then > for all the fragments. Yes, the angles between eye and sun are constants per frame throughout the scene :-) So is hazeColor. My problem is not passing the value from the property tree, my problem is getting it there - I'm not a C++ coder, I have no clue where to look for gl_LightSource outside the shader, I have no idea how (lat/lon/alt) property coordinates map into (x,y,z) in the rendering process and I have no real idea how to make a vec3 out of property values. Which is why I asked for help in the first place... * Thorsten P.S.: > The edge between fog/unfogged areas is too hard now, and it still doesn't > match the horizon. The edge is just as hard as it was previously - the functional form of the fading hasn't changed. But just insert any distance function you like in float fog_func (in float targ) {} and see what works best for your taste. As for matching the horizon - it did in all my tests which were not at sunrise/sunset - which combination of visibility-m ground-visibility-m and ground-haze-thickness are we talking? I have just tried a few realistic cases which I suspected to be problematic, but for instance a pathological case with ground-visibility > visibility would probably not work, ground-visibility > 25000 m starts to create other issues unless you really open visibility into the 100 km range, I haven't tried extreme fog like a 1 km thick layer with 50 m visibility. All I can say is that it worked seamless in normal cases for me. ------------------------------------------------------------------------------ The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel