 	}
 	for (uint i=0U; i<c_NumBinarySteps; ++i) {
 		vec4 c = 0.5 * (a + b);
-		c.w = get_latitude(c.xy);
+		Surface suf = get_surface(c.xy);
+		c.w = suf.low_alt;
 		if (c.z < c.w) {
 			b = c;
 		}else {

	vec4 step = (1.0 / float(c_NumForwardSteps + 1U)) * (b - a);
	for (uint i=0U; i<c_NumForwardSteps; ++i) {
		vec4 c = a + step;
		c.w = get_latitude(c.xy);
		if (c.z < c.w) {
			b = c;
			break;

	//Target0 = texture(t_Palette, pos.z / u_TextureScale.z);
	vec3 pos = cast_ray_to_map(u_CamPos.xyz, view);
	{
		Surface suf = get_surface(pos.xy);
		float terrain = float(suf.low_type) + 0.5;
		float diff = textureOffset(t_Height, suf.tex_coord, ivec2(1, 0)).x - textureOffset(t_Height, suf.tex_coord, ivec2(-1, 0)).x;
		float light_clr = texture(t_Table, vec3(0.5 * diff + 0.5, 0.25, terrain)).x;
		float tmp = light_clr - c_HorFactor * (1.0 - pos.z / u_TextureScale.z);
		float color_id = texture(t_Table, vec3(0.5 * tmp + 0.5, 0.75, terrain)).x;
