>>> The depth-pass-only pass is a well known optimization, but the fact it
>>> is not helping implies that our bottleneck is not in fragment
>>> processing.

Most of the discussion is drifting a bit over my head now, but I'm pretty sure 
that's not what I am talking about.

I am talking about a situation in which we run a fairly detailed shading scheme 
on the terrain (blend three textures with a gradient bias and add a heightmap 
for surface roughness to it and shade it all with the atmospheric scattering 
framework, possibly run more evnironment-dependent effects such as wetness).

In this situation my bottleneck is completely in the fragment shader (I also 
suspect that Rembrandt leans rather heavily on the fragment shader, because 
what else is there once you have rendered the whole scene to buffers?) - I can 
switch clouds on and off and don't see an effect in the framerate even if I 
draw them to 75 km distance, but I see an effect for almost every line I insert 
into the fragment shader. That situation is what I am interested in optimizing, 
and my CPU bottleneck is lightyears distant from there.

Now, I've tried a dumb scheme which allows you to define a per-plane 
3-parameter rectangular mask for the default cockpit view which is used to 
discard fragments in scenery rendering. The mask parameters are corrected 
outside of the rendering pipeline (currently in Nasal) for screen resolution, 
current fov and view axis and airplane-specific changes to the default view 
axis. The whole block of code doing this is ~20 lines, running once per frame 
the performance footprint is close to zero.

The mask has no transparency problems (because it's hand-crafted), it can 
usually get 2/3 of the pixels occupied by the panel, the test is done inside 
the first pass fragment shader which assigns a low depth to everything inside 
the mask so that fragments falling there are never computed in the detailed 2nd 
scenery pass.

For a plane like the A-10 which has a fairly good ground view, i get ~20% 
better performance in typical flight situations. For a typical airliner with 
quite restricted view, I get as much as 50% at cruise altitude. Just zooming 
into a planel view leads to almost all terrain fragments being discarded in the 
background and gives me a 100% performance increase, i.e. my performance is no 
longer restricted by the fragment shader, I'm seeing the vertex shader 
execution speed.

Now, the mask is so simple (it's just an angular region after all) that I 
imagine it might as well be used to pass vertices in the excluded region 
through the shader without wasting any time on them, thus also boosting vertex 
shader performance. The same mask can also be passed to the cloud fragment 
shader, allowing to get rid of cloud fragment creation in the region where we 
don't see it.

The whole scheme is in fact so successful that it's a pity it is too dumb to be 
implemented...

* 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

Reply via email to