How to set the "MagFilter" value in the Material file?

Hi monkeys! So, I had a problem about my texture being blurry, but it has been fixed by changing the MagFilter of my DiffuseMap to Nearest. Now, I just wanna know if there’s a way to make this change in the Material file (.j3m). Because I really want to just load my .j3o without doing anything else to make it look good.


There has been a change in this way for 3.1, but you couldn’t in 3.0

1 Like

Ok thanks @nehon. I guess it’s time now to change to 3.1!

This will also need to be documented as 3.1 is released.

1 Like

And yeah, this change has been made by @DannyJo, he’s the one to thank :wink:

1 Like

I still don’t know where can I set that value in the 3.1? Should I set in in the material or in the model?

In 3.1 you can set it either through the j3m or through code when you manually load the texture.

In order to do it through the j3m you do this:

Material Some Name : Common/MatDefs/Light/Lighting.j3md {
    MaterialParameters {
        DiffuseMap:  MagNearest  "textures/weather/cloud.jpg"

This will ensure the texture has magnification filter set to “Nearest”.

You can do the same with WrapMode using Wrap[MODE] where [MODE] is one of “Repeat”, “MirroredRepeat” or “EdgeClamp”. In fact any of the WrapMode enums will work. Repeat also accepts “_S”, “_T” and “_R” after to control the axis to wrap on.

You can specify several options in the j3m, just ensure that the texture path is last in the list. For instance.

DiffuseMap: Flip WrapRepeat_R MinBilinearNearestMipMap MagBilinear "textures/texture.png"

Hope that was clear enough. Better documentation will be available later on.

1 Like

Thanks, I understood without problems. However, something weird is going on:

This is my DfissueMap line in the .j3m:

DiffuseMap : Flip Textures/Pr_Arma_UVMap.png

When I try to type the MagNearest, it says the texture is missing:

DiffuseMap : Flip MagNearest Textures/Pr_Arma_UVMap.png

I tried to put the texture directory as a String… Still doesn’t work:

DiffuseMap : Flip MagNearest "Textures/Pr_Arma_UVMap.png"

I have tried to put the MagNearest before the Flip, use textures instead of Textures in the String, use any other parameters you specify above. Nothing works.

Could you provide the full stack trace please?

It doesn’t give me any stack trace, simply the preview of my texture in the material turns to a “texture missing” yellow image.

Now I have a doubt…was it done when 3.1 alpha went out?

ok… sorry the change is not in 3.1 alpha it’s been done a month later.
@Momoko_Fan @erlend_sh, seriously… let’s go beta…


Aha, that would be why.

So, is there already a JME 3.1-alpha 2 or something? Because at Github there’s only alpha 1 and I have no idea how to build the IDE.

./gradlew build
cd sdk
ant build-zip

So, which branch should I download then?

Hi? What of this four branches do I need to import? “PBRisComing”, “experimental”, “3.0” or “master” branch?

Use the master branch.

Thanks! I’ll try to build now and report if I get any problems.