Planetside Software Forums

General => Terragen Discussion => Topic started by: moodflow on November 18, 2008, 07:21:14 PM

Title: Extracting grayscale map from displacements
Post by: moodflow on November 18, 2008, 07:21:14 PM
Would anyone have any ideas on how to do this?  Everything I've tried so far has failed.

A good example is the alpine fractal shader.  Since its only a displacement effect, there is no associated color, therefore it can't be used as a mask. 
Title: Re: Extracting grayscale map from displacements
Post by: bigben on November 19, 2008, 12:26:56 AM
What sort of mask are you trying to make? You can convert it to something usable as a mask with various functions.
Title: Re: Extracting grayscale map from displacements
Post by: moodflow on November 19, 2008, 01:04:18 AM
It would be a grayscale map of the alpine fractal's displacements, similar to how the power fractal shader does it.   The darker the color the lower the altitude, and the lighter the color, the higher the altitude.  It would be nice to use these inherent "altitudes" in the alpine fractal to create a varying black and white map.  This map could be used as a blend shader.

For instance, the power fractal shader can be used both as displacement and/or as a grayscale map - colors are build in.  Using it as a grayscale map, you can plug it into other shaders' blend shader input to mask them based on the fractal. 

It seems the alpine fractal is the only node that doesn't output a grayscale map like all of the other fractals.
Title: Re: Extracting grayscale map from displacements
Post by: old_blaggard on November 19, 2008, 01:22:24 AM
You could apply a completely black surface to it and then create a surface layer that got brighter as you went up.
Title: Re: Extracting grayscale map from displacements
Post by: JimB on November 19, 2008, 04:55:33 AM
How about an ortho render from above. Make the entire surface a Constant white. Switch off all lights, reduce atmospheric density to zero. Make the Haze colour black, and play with the density and height of the Haze?
Title: Re: Extracting grayscale map from displacements
Post by: bigben on November 19, 2008, 06:08:32 AM
OK, I am assuming you want to make a mask of the fractal to apply to subsequent displacements?  The simplest thing would be a distribution shader.  To do this before the compute terrain node you need to add a Tex coords from XYZ and connect that to the input of a distribution shader, setting altitude restrictions to match your terrain.  You can then use this as a mask anywhere.
Title: Re: Extracting grayscale map from displacements
Post by: cyphyr on November 19, 2008, 06:31:35 AM
Its not going to be 100% accurate but the ortho render is the way I would go.


Hope this helps
Richard

<Edit: just saw BB's version, depending on your needs looks a more promissing route>
Title: Re: Extracting grayscale map from displacements
Post by: moodflow on November 19, 2008, 12:11:32 PM
You guys are the BEST!  Its always great to put heads together to come up with solutions like this.

Thanks for looking into this. 
Title: Re: Extracting grayscale map from displacements
Post by: moodflow on November 19, 2008, 12:21:28 PM
There has to be an easier way to pull this off.  I tried BB's method, but it still doesn't seem to pull off what I want, which is a mask that looks just like Cyphyr's posted results (though Cyphyr's method won't work for what I am doing.) 
Title: Re: Extracting grayscale map from displacements
Post by: bigben on November 19, 2008, 03:25:13 PM
Had another look at my model to see what wasn't performing as expected.   2 things will help in the distribution shader. 
* The altitude range is about 1200m to 300m so reduce the fuzzy zone to 900
* In the tweaks section, reduce the fuzzy zone softness to 0.5. The default is 1 which for this purpose is too high.

For additional tweaking you could add my friend the colour adjust shader after the distribution shader, and don't forget the gamma adjustments which may be useful in this case.