@nine2 You can also add them to the repo, as is done with other shaders.
What would you like for it to do specifically? At the moment it is an edge detection algorithm:
// phase 0
float4 TerrainPS0( TerrainPixel pixel) : COLOR0
{
float2 v0 = terrainSizeCoeff * pixel.world.xz;
float2 v1 = v0 + float2(1,0);
float2 v2 = v0 + float2(0,1);
float2 v3 = v0 + float2(1,1);
float2 t = v0 - floor(v0);
float2 h0 = tex2D(elevSampler,gridSizeCoeff*v0).rg;
float2 h1 = tex2D(elevSampler,gridSizeCoeff*v1).rg;
float2 h2 = tex2D(elevSampler,gridSizeCoeff*v2).rg;
float2 h3 = tex2D(elevSampler,gridSizeCoeff*v3).rg;
float2 h = clamp(lerp(lerp(h0,h1,t.x),lerp(h2,h3,t.x),t.y) - 0.0001,0,1);
float3 hypsometric = tex1D(hypsometricSampler,h.x).rgb;
float1 topographic = tex1D(topographicSampler,h.x).a;
return float4(hypsometric,topographic);
}
// phase 1
float4 TerrainPS1( FramePixel pixel) : COLOR0
{
static const half dx = 1.0 / frameWidth;
static const half dy = 1.0 / frameHeight;
float4 color = tex2D(frameSampler,pixel.texcoord);
half4 c = color.a;
/// The following edge detection filter was adapted from
/// and example provided by Mark J. Harris and GPGPU.org
half4 bl = tex2D(frameSampler,pixel.texcoord+half2(-dx,-dy)).a;
half4 l = tex2D(frameSampler,pixel.texcoord+half2(-dx, 0)).a;
half4 tl = tex2D(frameSampler,pixel.texcoord+half2(-dx, dy)).a;
half4 t = tex2D(frameSampler,pixel.texcoord+half2( 0, dy)).a;
half4 ur = tex2D(frameSampler,pixel.texcoord+half2( dx, dy)).a;
half4 r = tex2D(frameSampler,pixel.texcoord+half2( dx, 0)).a;
half4 br = tex2D(frameSampler,pixel.texcoord+half2( dx,-dy)).a;
half4 b = tex2D(frameSampler,pixel.texcoord+half2( 0,-dy)).a;
float topo = saturate( 16.0 * ( c - 0.125 * (bl + l + tl + t + ur + r + br + b )));
return float4(color.rgb - topo.rrr,0);
}
This is the input of the shader:
float4x4 viewMatrix;
float4x4 projMatrix;
float4 gridSizeCoeff;
float4 terrainSizeCoeff;
float1 terrainHeightScale;
float1 elevMaximum;
float1 elevMinimum;
float1 frameWidth;
float1 frameHeight;
texture elevTexture;
texture hypsometricTexture;
texture topographicTexture;
texture frameTexture;
texture decalTexture;
I'm not entirely confident what a 'hypsometricTexture' is. We can not add (or remove) input parameters, but we can toy with what it does with the input.