public int getSortId() {
        if (sortingId == -1 && technique != null) {
            sortingId = technique.getSortId() << 16;
            int texturesSortId = 17;
            for (int i = 0; i < paramValues.size(); i++) {
                MatParam param = paramValues.getValue(i);
                if (!param.getVarType().isTextureType()) {
                    continue;
                }
                Texture texture = (Texture) param.getValue();
                if (texture == null) {
                    continue;
                }
                Image image = texture.getImage();
                if (image == null) {
                    continue;
                }
                int textureId = image.getId();
                if (textureId == -1) {
                    textureId = 0;
                }
                texturesSortId = texturesSortId * 23 + textureId;
            }
            sortingId |= texturesSortId & 0xFFFF;
        }
        return sortingId;
    }
Returns the sorting ID or sorting index for this material.

<p>The sorting ID is used internally by the system to sort rendering
of geometries. It sorted to reduce shader switches, if the shaders
are equal, then it is sorted by textures.

@return The sorting ID used for sorting geometries for rendering.
jme3-core/src/main/java/com/jme3/material/Material.java