ye, already replicated and edited earlier post. just had assetManager.clearCache(); in wrong place.
Im trying to check now if i can find issue or not
Exporter:
so Exporter seems to export as Trilinear fine.
Importer:
So everything looks fine.
So next i tried things like:
SceneGraphVisitor visitor = (Spatial spatTraversal) -> {
if (spatTraversal instanceof Geometry) {
for (String name : Arrays.asList(new String[]{"ColorMap", "DiffuseMap", "BaseColorMap", "NormalMap", "MetallicRoughnessMap", "MetallicMap", "RoughnessMap"})) {
MatParamTexture tex = ((Geometry)spatTraversal).getMaterial().getTextureParam(name);
if (tex != null && tex.getTextureValue() != null) {
Material mat = ((Geometry)spatTraversal).getMaterial().clone();
mat.setTexture(name, tex.getTextureValue().clone());
((Geometry)spatTraversal).setMaterial(mat);
}
}
}
};
model.breadthFirstTraversal(visitor);
Because i thought maybe shader need re-send it or something.
But this change nothing.
While when doing:
SceneGraphVisitor visitor3 = (Spatial spatTraversal) -> {
if (spatTraversal instanceof Geometry) {
for (String name : Arrays.asList(new String[]{"ColorMap", "DiffuseMap", "BaseColorMap", "NormalMap", "MetallicRoughnessMap", "MetallicMap", "RoughnessMap"})) {
MatParamTexture tex = ((Geometry)spatTraversal).getMaterial().getTextureParam(name);
if (tex != null && tex.getTextureValue() != null) {
tex.getTextureValue().setMinFilter(Texture.MinFilter.Trilinear);
tex.getTextureValue().setMagFilter(Texture.MagFilter.Bilinear);
((Geometry)spatTraversal).getMaterial().setTexture(name, tex.getTextureValue());
}
}
}
};
model.breadthFirstTraversal(visitor3);
after model is saved and re-loaded it help. So im very confused.
So after each one i start compare result, thinking its some other param affecting filters:
So then i started checking mipmaps. and look this:
and after i setup trilinear/bilinear manually like:
tex.getTextureValue().setMinFilter(Texture.MinFilter.Trilinear);
tex.getTextureValue().setMagFilter(Texture.MagFilter.Bilinear);
its:
So suddenly “needGeneratedMips = true” instead of false.
When i use:
tex.getTextureValue().getImage().setUpdateNeeded();
this will not change into “needGeneratedMips = true”
Tho Texture have:
public void setMinFilter(MinFilter minificationFilter) {
if (minificationFilter == null) {
throw new IllegalArgumentException(
"minificationFilter can not be null.");
}
this.minificationFilter = minificationFilter;
if (minificationFilter.usesMipMapLevels() && image != null && !image.isGeneratedMipmapsRequired() && !image.hasMipmaps()) {
image.setNeedGeneratedMipmaps();
}
}
and Image have:
public void setUpdateNeeded() {
super.setUpdateNeeded();
if (isGeneratedMipmapsRequired() && !hasMipmaps()) {
// Mipmaps are no longer valid, since the image was changed.
setMipmapsGenerated(false);
}
}
hasMipmaps is:
public boolean hasMipmaps() {
return mipMapSizes != null;
}
So cant use setUpdateNeeded because it have marked as mipmaps are generated already.
And i cant use setNeedGeneratedMipmaps:
public boolean isMipmapsGenerated() {
return mipsWereGenerated;
}
/**
* (Package private) Called by {@link Texture} when
* {@link #isMipmapsGenerated() } is false in order to generate
* mipmaps for this image.
*/
void setNeedGeneratedMipmaps() {
needGeneratedMips = true;
}
because setNeedGeneratedMipmaps is like only not public method. Like someone forgot to put there “public” or it is not intended to be public one.
But setMinFilter() is using it via:
if (minificationFilter.usesMipMapLevels() && image != null && !image.isGeneratedMipmapsRequired() && !image.hasMipmaps()) {
image.setNeedGeneratedMipmaps();
}
So if we will look again at Exporter start object:
It do have marked that Image need generate Mips.
Tho it will not save Image because its not in list for saving it seems:
while lets look Importer:
It have image, tho it export as not need to generate mips.
just to say Image contructor or methods changing it as i seen were not exected during import.
Im currently trying to find out why Importer is loosing “needGeneratedMips = true”
Because i understand even new image should have it. But maybe it is because of TextureKey that have generateMips as false;
Normally if texture would use .setImage() it would auto-correct this, but capsule is not executing this method.