Glad of been helpful laugh
Maybe you need to encrease the zbuffer meassures. The render target and the source map need to be meassured square of two.

Code:
bmap_zbuffer ( bmap_createblack ( 4096, 2048, 32 ) );



The example is a zoom in, yes. That was the first step: converting the screen coords to map coords.

Now I am adding a fake anisotropy by 3x3 gaussian cubic samples to the shader but I get little inacuracies on the process. I am not sure if it comes from variable inacuracies or from that dx9 offset that has to be applied and I don't master xP

Anyway, this multisample method gives a pretty good zooming out results up to 1:4 scale. For smaller scales it will need more samples.

main.c
Code:
#include <acknex.h>

// Material skills
#define skPosX       skill9  // X coord relative to the center of the map in map coords (centered on the screen)
#define skPosY       skill10 // Y coord
#define skScale      skill11 // scale of the map
#define skScaleNext  skill12 // needed a map scale smooth transition variable

void main ()
{
	video_mode = 10;
	mouse_mode = 4;
	fps_max = 60;
	wait(1);
	
	BMAP *bmpMap = bmap_create ( "grid.tga" );
	BMAP *bmpScreen = bmap_createblack ( screen_size.x, screen_size.y, 24 );
	PANEL *panScreen = pan_create ( "flags=SHOW", 1 );
	panScreen->bmap = bmpScreen;
	MATERIAL *mtlCamMap = mtl_create ();
	mtlCamMap->skPosX = 0;
	mtlCamMap->skPosY = 0;
	mtlCamMap->skScale = 1;
	mtlCamMap->skScaleNext = mtlCamMap->skScale;
	effect_load ( mtlCamMap, "display_map.fx" );
	
	mtlCamMap->skill4 = floatd ( bmap_height(bmpScreen) * bmap_width(bmpMap), bmap_width(bmpScreen) * bmap_height(bmpMap) );
	var nProp = bmap_width(bmpScreen) / bmap_width(bmpMap);
	
	while ( !key_esc )
	{
		if ( mouse_left )
		{
			mtlCamMap->skPosX += mickey.x / mtlCamMap->skScale;
			mtlCamMap->skPosY += mickey.y / mtlCamMap->skScale;
		}
		if ( mickey.z > 0 )
		{
			mtlCamMap->skScaleNext = minv ( mtlCamMap->skScaleNext * 1.414, 2 ); // 1.414 ~= sqrt(2)
		}
		if ( mickey.z < 0 )
		{
			mtlCamMap->skScaleNext = maxv ( mtlCamMap->skScaleNext / 1.414, 0.25 );
		}
		mtlCamMap->skScale += ( mtlCamMap->skScaleNext - mtlCamMap->skScale ) * time_step * 0.5;
		
		mtlCamMap->skill1 = floatd ( mtlCamMap->skPosX, bmap_width(bmpMap) );
		mtlCamMap->skill2 = floatd ( mtlCamMap->skPosY, bmap_height(bmpMap) );
		mtlCamMap->skill3 = floatd ( nProp, mtlCamMap->skScale );
		mtlCamMap->skill5 = floatd ( 0.5, bmap_width(bmpMap) * mtlCamMap->skScale );
		mtlCamMap->skill6 = floatd ( 0.5, bmap_height(bmpMap) * mtlCamMap->skScale );
		bmap_process ( bmpScreen, bmpMap, mtlCamMap );
		
		wait(1);
	}
	
	mtl_remove ( mtlCamMap );
	pan_remove ( panScreen );
	bmap_remove ( bmpScreen );
	bmap_remove ( bmpMap );
	
	sys_exit ( NULL );
}



display_map.fx
Code:
float4 vecSkill1;
float4 vecSkill5;
texture TargetMap;
sampler ColorSampler = sampler_state { Texture = <TargetMap>; MipFilter = Linear; MinFilter = Linear; MagFilter = Linear; AddressU = Clamp; AddressV = Clamp; };

float2 fOffset3x3[9] = { -1,-1, 0,-1, 1,-1, -1,0, 0,0, 1,0, -1,1, 0,1, 1,1 };
float fGauss3x3[9] = { 0.0625, 0.125, 0.0625, 0.125, 0.25, 0.125, 0.0625, 0.125, 0.0625 };

float4 PS ( in float2 inTex: TEXCOORD0 ) : COLOR0
{
	inTex.xy -= 0.5f;
	inTex.xy *= vecSkill1.z;
	inTex.y *= vecSkill1.w;
	inTex.xy += 0.5f - vecSkill1.xy;
	float4 Color = 0;
	for ( int i=0; i<9; i+=1 )
		Color.rgb += tex2D ( ColorSampler, inTex + fOffset3x3[i] * vecSkill5.xy ).rgb * fGauss3x3[i];
	Color.a = 1.0f;
	return Color;
}

technique
{
	pass
	{
		VertexShader = null;
		PixelShader  = compile ps_2_0 PS();
	}
}



Salud!

Last edited by txesmi; 10/14/15 10:18. Reason: bamp_zbuffer syntax error x·