MSAA has no effect over skyboxes?

I’ve noticed that FXAA has effect (it blurs it a little) but MSAA has no effect since changing defaultpipeline.samples amount doesn’t introduce any effect.

Is there any other way to improve its quality as much as I could? I mean changing its filter or whatever.

Thank you in advance for any tip.

MSAA is used to anti-alias edge of triangles, so for a skybox it will be of little use.

What you want is to improve the texture rendering: use bigger textures, use better filtering (trilinear, anisotropic).

I’ve tried with cubetex.updateSamplingMode unfortunately bilinear and trilinear seem to have no difference and anyone using nearest will introduce jagged edges.

Also I tried to raise anisotropicFilteringLevel but it seems to have no effect at all.

I guess that at this point a repro will be needed as I can’t see any other things to test.

Here is the mandatory sample (I love playground!) Babylon.js Playground

Unfortunately I cannot modify my server CORS settings and the providen cubemaps are pretty low res.

If you don’t provide your own sky texture I don’t think we will be able to do much, as once you set the texture filter mode to trilinear + use anisotropic, you’re pretty much done regarding the technical part…

Maybe in your sky texture there’s something that can be improved and an artist (like @PatrickRyan) will be able to help.

This page can help regarding hosting your assets for use in the Playground: Using External Assets In the Playground | Babylon.js Documentation

@Escobar, I think I’m missing some context about what you are trying to do. What problem are you trying to solve with applying FXAA to your skybox? Can you provide any screen shots with with the actual assets you are using and what you are seeing so I can better understand the goal? I assumed from your message above that the playground you linked is not using the assets you are using locally.

If you can’t share the assets publicly, can you either message me directly or describe what your goal is with the skybox and what you are seeing currenly that is making you look at FXAA as a solve?

1 Like

My cubemaps seem to be a bit blurrier than the original images besides being rendered at 2048 per face.

textureSource.anisotropicFilteringLevel = value; should be enough to activate the anisotropic filter or should I mark any additional flag?

Thank you for your time

You will need to set a sample mode as either Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST, Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR or Constants.TEXTURE_LINEAR_LINEAR for anisotropic level to be in effect.

1 Like

I’ve made this small playground to test everything and seems that bilinear makes the best work, trilinear and linear_linear with a high value of anisotropy seems to be identical.

I miss a couple of things and I’ll need a tip, so I’ll also invoke the Cthulhu of Babylon @Deltakosh

  • How can I get the current filter? I mean I can update it but I don’t know what’s the current one.
  • What is the default one in Babylon? (since I cant read it I’m not sure) maybe trilinear?
  • How can I set it on loading for a cubemap? In my sample I’ve updated it after OnLoad is triggered.
  • If I’m not wrong Bilinear is even faster so from my needs it should be a no-brain choice, right?
  • Also I’ve noticed that if I disable mipmap creation on loading all seems to be like bilinear, is this right?

Thank you for your time!

Use texture.samplingMode. For CubeTexture, you will need to do texture.getInternalTexture().samplingMode.

It’s trilinear for regular textures and cube textures with mipmaps, and bilinear for cube texture without mipmaps.

Yes, you must set it after loading for cube textures if you want to change it because the value is written after the file has been loaded, so asynchronously from the js code. So, to be sure to overwrite the value, you should do it on the onLoad notification. That’s the same thing for regular textures, except you can also pass the value at construction time (5th parameter of the constructor).

In current GPU using bilinear or trilinear is not really significant in term of perf, you won’t see noticeable perf difference by choosing bilinear over trilinear.

Yes, if you disable mipmaps you will get bilinear by default (as trilinear as no point anyway, because there’s no mipmaps).