> You know that rendering a transparent object twice alter its > transparency. > Of course, you can avoid to render it in the color buffer using write > mask in one pass.
What I do with the trees is render just the opaque bits early on as white with essentially no light and fog computations to set the z-buffer and discard all transparent pixels in the first pass, then render the rest in detail with lequal comparison later. The first pass has just one texture lookup in the fragment shader, but what this saves is rendering the terrain pixels (and other trees) covered by the tree, and the terrain has a lot of complicated light and fog equations to solve, as well as up to four texture lookups and lots of noise generation. To trade that against an additional pass for trees which is essentially trivial turns out to be a really good deal. Of course, here's the part I don't know: All this makes perfect sense as long as the fragment shader is the bottleneck. But the first tree pass also needs the geometry computations in the vertex shader, and in an environment where the vertex shader is the bottleneck, it would make matters actually worse. So, the framerate gain for me personally left aside - what should I do with such things? Commit them and hope a majority will benefit? Not commit them? Make them optional and create a complicated rendering dialog? Test them and gather feedback? The idea with clouds is still to slip rectangles in which cover most of the opaque core of a cloud, render them into the z-buffer early on while passing through the normal clouds through vertex shading and discarding them in the fragment shader, and then render the rest of the clouds and the terrain with lequal comparison onto that depth buffer. I don't know if it actually works, but at least I'm pretty sure I understand now what is expensive about cloud rendering - funnily enough, it's fogging them. In a layer looking forward, we can have hundreds of cloud sheets overlapping all drawn from outside in, and so the fogging means we compute hundreds of exponential functions for every pixel... Depth buffering should definitely help here. * Thorsten ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel