3D Texture support

Yes, your 3d tex is compressed on disk and as compressed is also uploaded to gpu. And if your gpu supports it, it samples the 3d tex as compressed. So some loss of quality is expected. Thou, in your case, it looks like something is off. Maybe DDSLoader did not load it correctly?

1 Like

That’s what I think the issue is. I submitted:
DDS Loader issue with DXT3/DXT35 volume textures · Issue #1301 · jMonkeyEngine/jmonkeyengine · GitHub

2 Likes

The more I experiment with this, the more I believe there is some issue with this machine. I just tried TestTexture3DLoading with the default flame.dds file and this is the result.

It should be displayed as a 4x4 grid, but it is displayed like this. I have tried adjusting various 3d settings on my card (GTX 660) and my drivers are up to date. Not sure what the issue is. Loading the flame.dds into gimp and photoshop works fine. It is a 128x128x8 3d texture DXT5

Can you post a simple test case, then We can test it on our machines, or if you got more machines you can try on another.

The sample is on the github issue I logged above. I am trying to get everything installed on another machine to confirm the if this is really a loader issue or my system

public class TestTexture3DLoading extends SimpleApplication {

    public static void main(String[] args) {
        TestTexture3DLoading app = new TestTexture3DLoading();
        app.start();
    }

    @Override
    public void simpleInitApp() {
        viewPort.setBackgroundColor(ColorRGBA.DarkGray);
        flyCam.setEnabled(false);


        Quad q = new Quad(10, 10);

        Geometry geom = new Geometry("Quad", q);
        Material material = new Material(assetManager, "jme3test/texture/tex3DThumb.j3md");
        TextureKey key = new TextureKey("Textures/3D/flame.dds");
       
        key.setGenerateMips(false);
        key.setTextureTypeHint(Texture.Type.ThreeDimensional);

        Texture t = assetManager.loadTexture(key);
        t.setMinFilter(MinFilter.NearestNoMipMaps);
        t.setMagFilter(MagFilter.Nearest);
        int rows = 4;//4 * 4

        q.scaleTextureCoordinates(new Vector2f(rows, rows));

        //The image only have 8 pictures and we have 16 thumbs, the data will be interpolated by the GPU
        material.setFloat("InvDepth", 1f / 16f);
        material.setInt("Rows", rows);
        material.setTexture("Texture", t);
        geom.setMaterial(material);

        rootNode.attachChild(geom);

        cam.setLocation(new Vector3f(4.7444625f, 5.160054f, 13.1939f));
    }
}

is this necessary?
scaling texCoords by 4 in each direction would turn any 4 by 4 texture grid into a 16 by 16 grid on a quad.