> > Im the last weeks, I've been working on integrating Lauri's skydome
> > scattering shader in a seamless way with the rest of the environment. I
> > have now a working version of the shaders available which could be
> > committed.
> > This is:
> > * the original skydome shader, with an added simulation of a low
> > constant density haze layer and meaningful response to the parameters
> > /rendering/scene/overcast, /rendering/scene/scattering and
> > /rendering/scene/saturation.
> > * a matching terrain shader which connects to the skydome in a (mostly)
> > seamless way
> > * this can render everything from rather heavy fog on the ground to a
> > space view at high altitude with (mostly) seamless transitions
> > * some additional code getting the sunrise/sunset plausible by darkening
> > the haze where needed. See
> http://www.flightgear.org/forums/viewtopic.php?f=47&t=11274&start=135#p140 > > 031
> > for some recent pictures
> > * a small change in 3dclouds.frag to let clouds fade into a matching
> > horizon haze color.
> > All this is conceptually independent of Local Weather - while it is
> > supported and the relevant parameters are automatically set by Local
> > Weather, they can be set from anywhere else.
> > Now, I need some help.
> > First, the combined effect of lots of 3d clouds and haze shading isn't
> > fast. It isn't really slow either, with multiple layers of 6/8 clouds
> > drawn to 45 km distance I still get ~20 fps out (36 without the haze and
> > skydome shader for the same clouds), but I have the feeling it could go
> > faster, there's too much redundant things happening.
> > For instance, I get my altitude in model space by
> > vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0);
> > alt = ep.z;
> > in the vertex shader - but this could probably easily be passed as a
> > uniform if I just would know how (lat, lon, alt) maps into model space.
> > And so on. So if anyone with more experience in shader writing can look
> > over it and smooth it a bit, that'd be very good. There is a writeup of
> > the underlying ideas available, and I have tried to comment a lot, and I
> > can also explain the underlying math.
> > The second thing is - I can't get it into a distributable form myself. I
> > don't understand the structure of effect files. In my current
> > implementation, I have just overwritten the Flightgear defaults, used
> > really ugly hack at one point and distributing that in this form means
> > either using my skydome/terrain or CPU rendering. I don't want to commit
> > it in such a form, this should be optionally linked to the scattering
> > shader on/off. Also, I run into other problems - I've tried to use the
> > haze shader instead of object default, but they're not blended to the
> > final color when fully fogged, they come out too dark, and I don't know
> > why. I suspect that something happens to objects later that doesn't
> > to terrain... So, I'd need the help of someone who understands the
> > file structure to create a structure which can be committed without
> > wrecking everything else.
> > If anyone is willing to help with either problem, please let me know and
> > then we can take the bulk of the technical discussion off list (where I
> > can use attachments). I have a pretty good idea what the issues are and
> > what direction one should probably go to address them - I'm just a bit
> > of my depth doing it myself.
> Looks like you are doing things the hard way. Emilian and I are busy
> rationalizing, and combining and improving shaders as appropriate right
> now: we would be happy to add your stuff to the pile.
> You could do a merger request to our sandbox here:
> https://gitorious.org/fgdata-textures-ng/fgdata-textures-ng >
> Or post the files somewhere that we can get them, or email them as an
> attachment to me. I can't promise an instant solution, because we already
> have a heavy workload in FG and RL, but we can take a look.
Emilian and I have been busy investigating the integration of these shaders
into the shader system that we are evolving. The good news is that we have
come up with a fog function that can be easily included in all relevant
shaders. The bad news is that in doing so we have bumped up against what we
believe are bugs in your original shaders. The haze seem to work fine in
some situations - but not in others. In particular, there is a problem over
this is caused, we think, by the haze being attached to the vertices in the
tile in the .vert. This bug is actually present over land tiles as well -
just harder to see. We tried to fix it by increasing markedly the number of
vertices in the tile to no avail, and then by moving the some of the
functions into the .frag, but then the haze no longer had the right depth:
but this isn't a unique haze problem. There are also bugs in the skydome:
there is a very visible "tear", and we have some difficulties with the
colours that, at least to some observers, seem unnatural. Laurie has said
that he will try to have a look at this in the coming weeks.
We attach our fog include files that we would call in all relevant shaders.
You can see how we intend to use them in our sandbox here: