Thanks. Here is the working HLSL code:
float Width : register(C0);
float Height : register(C1);
sampler2D image : register(s0);
noperspective float2 TEXCOORD;
static const float2 size = {2.0,0.0};
static const float3 off = {-1.0,0.0,1.0};
static const float2 nTex = {Width, Height};
float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 color = tex2D(image, uv.xy);
float2 offxy = {off.x/nTex.x , off.y/nTex.y};
float2 offzy = {off.z/nTex.x , off.y/nTex.y};
float2 offyx = {off.y/nTex.x , off.x/nTex.y};
float2 offyz = {off.y/nTex.x , off.z/nTex.y};
float s11 = color.x;
float s01 = tex2D(image, uv.xy + offxy).x;
float s21 = tex2D(image, uv.xy + offzy).x;
float s10 = tex2D(image, uv.xy + offyx).x;
float s12 = tex2D(image, uv.xy + offyz).x;
float3 va = {size.x, size.y, s21-s01};
float3 vb = {size.y, size.x, s12-s10};
va = normalize(va);
vb = normalize(vb);
float4 bump = {(cross(va,vb)) / 2 + 0.5, 1.0};
return bump;
}
Where should I increase the intensity? On the heightmap, or after generating the normal like (cross(va,vb)) * n + 0.5, and just playing with n. In general if I want to add more effects like sharpen, noise, large/medium/small detail, should I do it before generating the normal map or after.
Edit:
Okay I was doing some testing and applying the normal map effect last seems to work nicely. The brightness/contrast, sharper effects are being applied on the height map.