On Sun, Feb 5, 2012 at 7:50 AM,  <thorsten.i.r...@jyu.fi> wrote:
>
> I haven't really seen any guidelines about efficient shader coding, but
> I've come across a few statements here and in the forum now and then,
> which I so far assumed to be true. I've now spent the last few days
> benchmarking my lightfield/terrain haze framework to see if I can't
> squeeze a bit more performance out. Since the results somewhat
> contradicted things I have assumed to be true before, I thought I might
> share my observations.
>
> 1) vertex shader is fast and efficient, fragment and geometry shaders are
> comparatively slow and cost performance
>
> I don't know who stated that here, but I intuitively assumed that this
> must be right. You can imagine that I was surprised that when I
> trivialized the fragment part of my code, the performance didn't change at
> all, but when I trivialized the vertex part, the performance doubled.
>
> So it seems like the whole performance drain of my code is caused by an
> overworked vertex shader. I then transferred the haze color computations
> to the fragment shader, which improved overall performance in my
> benchmarks by 20-40%. It seems the optimal results appear for a shared
> workload between vertex and fragment shader.
>
> Since for instance 3d clouds run almost exclusively via vertex shader,
> this may not be an otherwise irrelevant observation.
>
> 2) vertex count doesn't matter
>
> I've read that in the forum as advice to model-builders quite often. For
> all I can test, that's wrong. In order to get the same framerate in
> default scenery and custom Italy CORINE scenery, I have to set the
> visibility range ~a factor 10 different. That's consistent with a hundred
> times higher vertex count in the CORINE scenery, or with a factor 10
> higher linear resolution of landcover and elevation data, which seems
> about right. So the vertex count more or less directly sets my framerate.
>
> This is also relevant for models, because having a cluster of ~ 5 AI
> planes (which happened to be stuck into each other) in my view or not
> caused a 25% change in framerate, so the vertex count of models matters
> compared with the vertex count of scenery and is not some insignificant
> correction.


Thorsten,

#2 has long been a point of frustration for me. I've given up trying
to address folks on the forum who say "throw all the vertices/polygons
at it that you like! Graphics cards can handle millions with no
problem!" Last time I looked there was even an FG wiki article that
advised modelers to use as many polygons as they like.

I've worked in the gaming world long enough to know otherwise. Total
scene resources matter. Sure, graphics cards are optimized to quickly
render large, well-designed objects. You can build a beautiful model
with hundreds of thousands of polygons and that's great. But when it's
in a scene with gazillions of other objects, it's a hit. Animate it
and the situation just gets worse. This is why game designers build
objects with minimal vertices and create detail using good texture and
shading tricks. People need to understand that their wonderful
creations must live and play in the same sandbox as other wonderful
creations.

But I am not going to rant. I am not going to rant. I am not going to rant... ;)

-Gary aka Buckaroo

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to