Wednesday, December 10, 2008

Auto-Variation and Repetition

In my previous post I discussed variation as a way to hide the artifacts of land use texturing. Now we can talk about this bug.

What are these weird artifacts that show up over the terrain when shaders are on?  Well, they should (and will in 930) look like this:

But what's going on?  The answer is auto-variation.

In X-Plane 8, variation is created by using multiple layers, each one applying a texture at a different offset.  This technique works on a wide range of hardware, but is inefficient - it causes overdraw (which we know is very bad).  

So in X-Plane 9 I replaced this layer-based variation with a pixel shader algorithm.  This means less information in the DSF (which means smaller DSFs, faster loading and less RAM use), but it also means variation is only visible to those with shaders.  Having the pixel shaders create variation dynamically on the GPU is called "auto-variation" (and is invoked via the AUTO_VARY command in a .ter file).

The artifact above was a bug in the auto-variation shader.  With the code now fixed (the 930 patch will contain the fix), here are some images of how it is supposed to work:

Here we have the texture in question, at two different offsets.


This black and white texture is the "mixing mask" used to select which offset to use.

And this is the final result.

There is a little bit more disruption in the columns of green park.

3 comments:

Anonymous said...

Ben,

You wrote : "This means less information in the DSF (which means smaller DSFs, faster loading and less RAM use), but it also means variation is only visible to those with shaders."

Shouldn't it mean it would improve the fps when shaders are on?

Benjamin Supnik said...

@lex - usually yes. The work of variation is changed...in v8 it meant more layers, more overdraw, more vertices. In v9, it means more complex shaders.

So on a system with plenty of unused shader power, this change in resource use will mean more fps.

On a machine with plenty of bus bandwidth and fill rate, but not much shader power, this would not mean a fps improvement.

Generally speaking, for most cases, this is a win though...shader power is much more available than "ROP" (raster operation" fill-rate, at least for the relatively simple shaders we use.

Claudio said...

Hello Benjamin,

I know this post is 2 years old but I'm still experiencing this issue with X-Plane 9.62 and ATI Mobility Radeon HD4670 1GB. Has this been addressed? More info here (will post screenshots this evening):

http://forums.x-plane.org/index.php?showtopic=48722

Thanks.