On Wed, Jul 18, 2012 at 8:27 AM, Renk Thorsten <thorsten.i.r...@jyu.fi> wrote:
>
> May I ask yet another dumb question?
>
Yes, although this isn't a dumb question.
> In the first rendering pass of default terrain rendering, we use default.vert 
> and terrain-nocolor.frag as shaders. I have so far mindlessly copied the 
> first pass since I had no real clue as to what it is for. Its purpose seems 
> to be to establish that faraway scenery is not rendered in front of nearby 
> scenery (I think Fred called this 'initializing the z-buffer').

This is an optimization to avoid running really expensive shaders on
geometry that will be hidden from view. The GPU has an "early Z"
capability and won't run a fragment shader if it knows the result will
be discarded. Of course, to be effective the shaders run when the
depth buffer is filled need to be fast :)
>
> My question is - why do we use shaders which texture and fog the terrain at 
> this stage? Every texture2D() statement seems to cost me ~12% of my 
> framerate. I've experimentally replaced default.vert and terrain-nocolor.frag 
> by trivial.vert which is just ftransform(); and trivial.frag which is just 
> gl_FragColor = vec4 (1.0, 1.0, 1.0, 1.0);, and apart from my ~12% increase in 
> framerate I haven't seen any bad side effects - the z-ordering of scenery 
> looks sane, fogging, texturing and colors work normal,...
>
> So, was there a reason we texture and fog during the first pass and should I 
> see any unexpected side effects, or can I simply use the trivial shaders and 
> get my 12% framerate?

The main reason to render textures at this stage is that textures with
transparency do change the fragments that are rendered. Calculating
the fog color seems wrong, but I don't have the sources in front of me
and gitorious is acting up.

one texture2D() call -> 12% framerate drop seems a bit excessive. What
is the time difference in milliseconds? Hardware?

Tim
>
> Thanks,
>
> * Thorsten
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Flightgear-devel mailing list
> Flightgear-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to