I’am new in JME :). I am using the JME to develop a game for my final project. My game is a kind of driving simulation.
I made the scene using blender, export it as OGRE scene, then load it.
The problem is the texture of the road markings in front of the car looks blur. I think it doesn’t matter if the blur occurs far in front of the car.
QUESTION: What causes the road markings’ textures look blurry? Is there a way so that the texture of the road markings do not look blurry? Screenshoot:
Thank you very much for your attention.
Normally blured textures in the distance is an artifact of mipmaping. This is a technique which reduces flickering and alias problem in 3D rendering.
I don’t think you want to turn of mipmaps (trilinear filtering) but you can change the MinificationFilter on Textures in code. But I’m not sure if this is the cause of your problems.
Try higher res textures…
@kwando: thank you very much :D, seems like mipmaps was the cause. I have tried BilinearNoMipMaps MinFilter and textures appear as good as i want. I also tried NearestNoMipMaps and seems like the result is the same as BilinearNoMipMaps.
QUESTION: Do the BilinearNoMipMaps and NearestNoMipMaps have a different performance? Because I can’t see any difference in my game’s fps and i have no knowledge in texture filtering. My game still run smoothly at 80-100fps.
@zarch: i already use high res texture 8).
Modern GPU:s are good at texture filtering, that’s not the first thing to worry about
I think not using mipmaps could increase the memory bandwidtdh (memory bandwidth is precious) and be worse for the cache, but this is just me guessing.
Best thing is to measure
@kwando: thank you for quick reply :). Now i can continue my project. Still lots of work to be done.
Not using mipmaps will lead to aliasing artifacts, use anisitropic filtering for the texture
Wow, the textures appear smoother and less flickering :D. I didn’t mind the flickering before, but now the textures looks better with less flickering. Thank you. I really need to learn more.
@generalkyu you will need to set Anisotropy for your texture by yourself. By default Anisotropy = 0. I would recommend you to set Anisotropy to 2 or 4.
For example in Left4Dead2 default anisotropy = 2. Also, in Left4Dead only 5 levels of mipmap of textures.
Mipmaps are vital. They are should be used.
Just try to set anisotropy for your textures.
For example I load a texture like this:
// Set Diffuse Map
String strDif = texturePath ;
TextureKey tkDif = new TextureKey(strDif, false);
if (strDif.indexOf(".dds") < 0) tkDif.setGenerateMips(true); // if this is not DDS texture
Texture diffuseTex = asset.loadTexture(tkDif); // Load a texture
matNew.setTexture("DiffuseMap", diffuseTex); // Set diffuse map
Is there a way to set anisotropy in j3m?
I did not find the way. Possibly, we need a feature request for the Normen (j3m). Or get the feature to the assetManager(apply to all textures) for the Momoko_Fan.
@mifth : thanks a lot :). I’ve tried it and the result was great and almost the same with my code before. No need to change the MinFilter on textures. This is my code before (i just implemented it with my poor knowledge :roll: ) :
Texture pendek_normal = getAssetManager().loadTexture(“Materials/asphalt_short_normal.jpg”);
as you said, i changed it :
TextureKey jalan_pendek__diffuse_key = new TextureKey(jalan_pendek_url, false);
if (jalan_pendek_url.indexOf(".dds") < 0) jalan_pendek__diffuse_key.setGenerateMips(true);
Texture pendek_diffuse = getAssetManager().loadTexture(jalan_pendek__diffuse_key);
what is the difference of using/not using TextureKey? Thank you for your help :).
@generalkyu you should use MipMaps.
- Do you use dds textures? if yes, so you need to generate mipmaps with dds generation.
in your old code i see “BilinearNoMipMaps” is used. I suppose you do not generate mipmaps at all. But mipmaps are needed for better performance.
Try this (without “if(…)”):
it will always generate MipMaps.
Thank you @mifth
I learn a lot from this forum,