Distance Shader Stack to the rescue

Started by moodflow, April 05, 2008, 04:30:39 PM

Previous topic - Next topic

moodflow

One of the things I've noticed in most landscape generation software is the lack of larger scale detail on shaders off in the distance.  The reason is simple:  the textures (regardless of type) don't scale up the farther away they are from the camera.  With this, textures become small and smooth once the detail goes below pixel level.  This is usually NOT how it works in real life.

I found a way to resolve this using TG's distance shader, by placing it in a "stack". 

Here is the idea:
Have a normal scale texture in the foreground (well, as we normally do).  Now, as the distance from the camera increases, softly blend this texture into a texture scaled larger, and keep doing this as the distance increases, with more and more textures.  That way detail remains, even in the distance.  And this method can include the minor displacements in the textures, as they will softly blend up in scale just as well.

When done with image maps, the result is phenomenal, as the terrain in the distance will finally have solid detail!  This method also helps "blend out" tiling artifacts which tend to plague image maps on planes or over a distance.

There are some drawbacks with this technique:
-It will likely not work well in an animation since the textures key off the camera and if the camera moves, so does the distance stack effects (this needs to be tested)
-If the distance shaders scale up smoothly, its possible to make the detail stay the exact same size, which ends up looking very similar to using an image map shader with through camera projection.

Anyway, I've attached the .tgd file for you all to check out and use.  Be sure to test it with different distance ratios, and different textures, including image maps and power fractals.

In this particular TGD, everything scales up by 2x for each level, which means fractal scale, distance, and displacement.

So from the camera:  0-50 meters is the normal texture, 50-100 is the same texture doubled in scale, 100-200 is the same texture quadrupled in scale, 200-400 - etc.

Below are some sample images of a normal texture rendered on a plane without the distance stack, labeled "off", and the other image using the distance stack, labeled "on".  I think it makes a great difference, and can be especially seen if you flip between the images.

I've also attached a simple colors example, showing how the textures blend over distance.

Unfortunately, I am stuck at work and don't have my original studies to post at this time (which show how the image maps look), so I am posting some quick setups I created here at work to display the effect.
http://www.moodflow.com
mood-inspiring images and music

rcallicotte

This is interesting.

How did you come up with this?  I'm happily amazed at how many here find time to think through such things.  Good work!
So this is Disney World.  Can we live here?

moodflow

Quote from: calico on April 05, 2008, 07:26:28 PM
This is interesting.

How did you come up with this?  I'm happily amazed at how many here find time to think through such things.  Good work!

Thanks Calico.  This was mainly an offshoot of the fractal stack concept (http://forums.planetside.co.uk/index.php?topic=3256.0), which was originally created to resolve the "detail lost in the distance" problem.

This new method gives maybe even better results and is much faster to render.  And it can be used with image maps just as easy.
http://www.moodflow.com
mood-inspiring images and music

buchvecny

wow thats super great find why doesnt anybody praise you tho? possibly only yet found well not workaround but a way, to effectively increase the subhorizon detail :D i made up a new word!