On Monday 24 October 2011 11:27:11 thorsten.i.r...@jyu.fi wrote:
> > Yes, doing stuff once per vertex rather than once per pixel is faster,
> > but also
> > may lead to poor results. The more stuff you do in the vertex shader the
> > more
> > visible the mesh grid will be.
> 
> Maybe someone can really enlighten me on this point:
> 
> My understanding is that
> 
> * the vertex shader computes stuff for each vertex
> 
> If I don't use a fragment shader (as e.g. in the 3dclouds), things like
> shading get a linear interpolation between vertices.
> 
> * the fragment shader allows me to specify a non-linear function to
> interpolate between vertices
> 
> If I have two points with distances d1 and d2, I can either compute fog1 =
> exp(-d1/vis) and fog2 = exp(-d2/vis) in the vertex shader.
> 
> The result will then be a linear increase in fog from fog1 at d1 to fog2
> at d2  - which is in general very wrong for large d1-d2 because the actual
> result is exponential and not linear. Or I can pass d1 and d2 to the
> fragment shader and compute the non-linear exponential there - which would
> give me the correct result, since a linear interpolation between d1 and d2
> actually should be an exact result.
> 
> So there should in fact not be any loss of accuracy when I move linear
> quantity computations to the vertex shader, this should only be true if I
> move non-linear quantities.
> 
> Is this essentially correct?
> 
> * Thorsten

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.

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.

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. It can be changed outside the shader, but it will affect 
the whole mesh. 

------------------------------------------------------------------------------
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

Reply via email to