What does d3d_anisotropy do?

Posted By: Valdsator

What does d3d_anisotropy do? - 07/24/12 00:09

As I understand it, anisotropic texture filtering (which d3d_anisotropy controls according to the manual) is supposed to make textures farther away appear less blurry by using non-square low resolution textures when needed (looking at something from an angle).

But, when I turn on anisotropic texture filtering in 3DGS, it doesn't appear to really do anything like that.



In fact, the only thing it does is fix an odd clipping issue. Does it do something else? Am I not activating it correctly? d3d_anisotropy is set to 7 (I've tried other numbers as well) before loading a level, and I assume on the first frame (if the main function runs on the first frame... which I would think it does). I've also tried changing d3d_mipmapping in case it affected anisotropic filtering, but it still doesn't work.
Posted By: MasterQ32

Re: What does d3d_anisotropy do? - 07/24/12 06:49

afaik it removes the flickering effect if you got high-resolution textures viewing from long distances
according to the manual you have to set d3d_mipmapping to 4 or higher to activate the feature
i think your texture is far to lowres and to linear to get really good visible results, try some 1024² Gras Texture with low scale
results should be much more visible
Posted By: rojart

Re: What does d3d_anisotropy do? - 07/24/12 09:29

I had the same problem since A7 in this thread, but in german.

In my experience, d3d_anisotropy acts as a switch and nothing more.

In the meantime, I found a shader solution:

mips_aniso.wmb

Code:
#include <default.c>

FONT* A24bi = "Arial#24bi";

var vAniso = 8.0;

MATERIAL* mtl_anisotropic = 
{
	effect = "
	bool AUTORELOAD;

	float vAniso_var;

	texture entSkin1;
	sampler sAnisotropic = sampler_state {
		Texture = <entSkin1>;
		
		MipFilter = Linear;
		MinFilter = Anisotropic;
		MagFilter = Linear;
		
		MaxAnisotropy = vAniso_var;  
		
		AddressU = Wrap;
		Addressv = Wrap;
	};
	
	technique anisotropic {
		pass one {
			sampler[0] = (sAnisotropic);
		}
	}";
}

VIEW* camera1 = {size_x = 400; size_y = 800; flags = SHOW;}
VIEW* camera2 = {pos_x = 400;	size_x = 400; size_y = 800; flags = SHOW;}

function main() 
{
	vec_set(sky_color,COLOR_BLACK);
	video_window(NULL,NULL,2,NULL);
	video_set(800, 800, 32, 2);
	
	//if (d3d_caps & 2) { d3d_mipmapping = 4; d3d_anisotropy = 16;  printf("d3d_anisotropy active");}
	
	mouse_mode = 4;
	mip_levels = 10;
	d3d_anisotropy = 7;
	d3d_mipmapping = 4;
	
	level_load("mips_aniso.wmb");
	
	camera.flags &= ~SHOW;
	
	vec_set(camera1.x,vector(0,0,150));
	vec_set(camera1.pan,vector(0,-30,0));
	
	vec_set(camera2.x,vector(15000,0,-350));
	vec_set(camera2.pan,vector(0,-30,0));
	
	PANEL* pAniso = pan_create(NULL,0);
	
	pan_setdigits(pAniso,0,10,60,"Anisotropy Level = %.f", A24bi, 1, vAniso);
	
	pan_setstring(pAniso,0,300,  0,A24bi,str_create("mip_levels = 10;"));	
	pan_setstring(pAniso,0, 10, 90,A24bi,str_create("Anisotropy Enabled"));
	pan_setstring(pAniso,0,500, 60,A24bi,str_create("d3d_mipmapping = 4;"));
	pan_setstring(pAniso,0,500, 90,A24bi,str_create("d3d_anisotropy = 7;"));	
	pan_setstring(pAniso,0,500,120,A24bi,str_create("Anisotropy Disabled"));
	
	pan_setslider(pAniso,0,250,60,bmap_fill(bmap_createblack(100,1,32),COLOR_GREY,100),bmap_fill(bmap_createblack(12,32,32),COLOR_RED,100),0,16,vAniso);
	
	set(pAniso, SHOW);
	
	vec_fill(mtl_anisotropic.ambient_blue, 20);
	
	/*while(1) 
	{
		camera1.pan += .1*time_step;
		camera2.pan -= .1*time_step;
		wait(1);
	}*/
}


Posted By: Uhrwerk

Re: What does d3d_anisotropy do? - 07/24/12 11:16

You also have to set d3d_mipmapping to 4 in order to activate anisotropic filtering. Did you keep that in mind?
Posted By: rojart

Re: What does d3d_anisotropy do? - 07/24/12 11:54

Originally Posted By: Uhrwerk
You also have to set d3d_mipmapping to 4 in order to activate anisotropic filtering. Did you keep that in mind?

Of course, like code above.

But really, this is not needed, when I use my aniso shader workaround.
Posted By: Uhrwerk

Re: What does d3d_anisotropy do? - 07/24/12 17:03

Yeah, sure, I saw that in your code. My comment was meant for Valdsator. You already seem to have put a some effort in that issue. It's strange. Anisotropy always worked for me right out of the box.
Posted By: Valdsator

Re: What does d3d_anisotropy do? - 07/24/12 18:19

Yes I did try to change d3d_mipmapping to 4 (and other values) in many different places, just in case that mattered.

Honestly I'm just looking for all the options a player might want to change in the game, so if it doesn't work, it's not exactly required. It is strange, though.
© 2024 lite-C Forums