Terrain material with texture array?

didnt @yaRnMcDonuts had one here?

Im using Texture Array for terrain textures like:

frag:

uniform sampler2DArray m_PhongTextures;
uniform sampler2DArray m_NormalmapTextures;
uniform sampler2DArray m_ParallaxmapTextures;
uniform sampler2DArray m_RoughnessmapTextures;

if you want read:

tempAlbedo.rgb = texture2DArray(m_PhongTextures, vec3(coord##index, texIndex) ).rgb;\

j3md:

        TextureArray PhongTextures
        TextureArray NormalmapTextures -LINEAR
        TextureArray ParallaxmapTextures -LINEAR
        TextureArray RoughnessmapTextures -LINEAR

java:

import com.jme3.texture.TextureArray;

using:

        List<Image> phongTextureList = new ArrayList<>();

        // some code to fill, remember about below(tho im not sure if needed here):
        phong.setWrap(Texture.WrapMode.Repeat);


        TextureArray phongTextures = new TextureArray(phongTextureList);
        phongTextures.setWrap(Texture.WrapMode.Repeat);
        phongTextures.setMinFilter(Texture.MinFilter.Trilinear);

        // some material init code / etc

        mat.setTexture("PhongTextures", phongTextures);
3 Likes