According to this page on the wiki: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:anisotropic_filtering you can set anisotropic filtering for all textures loaded by the AssetManager via an AssetEventListener. I’ve attempted to do this but it does not produce any results.
Here is a simple test program that I attempted to use (note: don’t forget town.zip if you try this)
[java]
import com.jme3.app.SimpleApplication;
import com.jme3.asset.AssetEventListener;
import com.jme3.asset.AssetKey;
import com.jme3.asset.TextureKey;
import com.jme3.asset.plugins.ZipLocator;
import com.jme3.light.AmbientLight;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Spatial;
@SuppressWarnings(“rawtypes”)
public class AnisotropicTest extends SimpleApplication {
public static void main(String[] args) {
AnisotropicTest app = new AnisotropicTest();
app.start();
}
@Override
public void simpleInitApp() {
AssetEventListener asl = new AssetEventListener() {
public void assetLoaded(AssetKey key) {
// throw new UnsupportedOperationException(“Not supported yet.”);
}
public void assetRequested(AssetKey key) {
if (key.getExtension().equals("png") || key.getExtension().equals("jpg") || key.getExtension().equals("dds")) {
TextureKey tkey = (TextureKey) key;
tkey.setAnisotropy(8);
}
}
public void assetDependencyNotFound(AssetKey parentKey, AssetKey dependentAssetKey) {
// throw new UnsupportedOperationException(“Not supported yet.”);
}
};
assetManager.addAssetEventListener(asl);
AmbientLight al = new AmbientLight();
al.setColor(ColorRGBA.White.mult(4));
rootNode.addLight(al);
assetManager.registerLocator("town.zip", ZipLocator.class);
Spatial gameLevel = assetManager.loadModel("main.scene");
gameLevel.setLocalTranslation(0, -5.2f, 0);
gameLevel.setLocalScale(2);
rootNode.attachChild(gameLevel);
}
}
[/java]
Here are the results for running that program (left = code above, right = forcing 8x anisotropic filtering in graphics control panel)
I am unsure if this functionality has been removed or if there is a bug or if I’m maybe adding the listener in the wrong place or what.
I’m using the latest build from the svn. I appreciate any help.