This test uses 'AdvancedPBRTerrain.j3md' to create a terrain Material with
more textures than 'PBRTerrain.j3md' can handle.
Upon running the app, the user should see a mountainous, terrain-based
landscape with some grassy areas, some snowy areas, and some tiled roads and
gravel paths weaving between the valleys. Snow should be slightly
shiny/reflective, and marble texture should be even shinier. If you would
like to know what each texture is supposed to look like, you can find the
textures used for this test case located in jme3-testdata. (Screenshots
showing how this test-case should look will also be available soon so you can
compare your results, and I will replace this comment with a link to their
location as soon as they are posted.)
Press 'p' to toggle tri-planar mode. Enabling tri-planar mode should prevent
stretching of textures in steep areas of the terrain.
Press 'n' to toggle between night and day. Pressing 'n' will cause the light
to gradually fade darker/brighter until the min/max lighting levels are
reached. At night the scene should be noticeably darker, and the marble and
tiled-road texture should be noticeably glowing from the emissiveColors and
the emissiveIntensity map that is packed into the alpha channel of the
MetallicRoughness maps.
The MetallicRoughness map stores:
- AmbientOcclusion in the Red channel
- Roughness in the Green channel
- Metallic in the Blue channel
- EmissiveIntensity in the Alpha channel
The shaders are still subject to the GLSL max limit of 16 textures, however
each TextureArray counts as a single texture, and each TextureArray can store
multiple images. For more information on texture arrays see:
https://www.khronos.org/opengl/wiki/Array_Texture
Uses assets from CC0Textures.com, licensed under CC0 1.0 Universal. For more
information on the textures this test case uses, view the license.txt file
located in the jme3-testdata directory where these textures are located:
jme3-testdata/src/main/resources/Textures/Terrain/PBR
Notes: (as of 12 April 2021)
-
The results look better with anti-aliasing, especially from a distance. This
may be due to the way that the terrain is generated from a heightmap, as
these same textures do not have this issue in my other project.
-
The number of images per texture array may still be limited by
GL_MAX_ARRAY_TEXTURE_LAYERS, however this value should be high enough that
users will likely run into issues with extremely low FPS from too many
texture-reads long before you surpass the limit of texture-layers per
textureArray. If this ever becomes an issue, a secondary set of
Albedo/Normal/MetallicRoughness texture arrays could be added to the shader
to store any textures that surpass the limit of the primary textureArrays.