-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Per-Layer TriPlanar and Refactoring for PBR Terrain Shaders #2353
Conversation
jme3-terrain/src/main/resources/Common/MatDefs/Terrain/AdvancedPBRTerrain.j3md
Outdated
Show resolved
Hide resolved
jme3-terrain/src/main/resources/Common/MatDefs/Terrain/AdvancedPBRTerrain.j3md
Outdated
Show resolved
Hide resolved
jme3-terrain/src/main/resources/Common/MatDefs/Terrain/AdvancedPBRTerrain.j3md
Outdated
Show resolved
Hide resolved
jme3-terrain/src/main/resources/Common/MatDefs/Terrain/Modular/PBRTerrainUtils.glsllib
Show resolved
Hide resolved
@capdevon The only thing I didn't do yet is cleanup TerrainUtils.glsllib because I still have plans to add more functions to that file to support PBRTerrain (right now it only works for reading texture arrays for advancedPBRTerrain). Once everything is approved and finalized for the approach I took to modularize AdvancedPBRTerrain, then I'll adapt things the same way for PBRTerrain. Then after that I'll do a final code cleanup to PBRTerrainUtils once its mostly done changing. |
Refactored AdvancedPBRTerrain and PBRTerrain to work with the new modular system, making the shader much less confusing and easier to work with.
I also added 12 new boolean matParams (1 per layer) to toggle tri-planar mode on a per layer basis. The old UseTriPlanar boolean still works to toggle triplanar for the whole terrain, but now you also can enable triplanar for just 1 or 2 layers that need it most. (for example, mountain textures that are painted on vertical slopes typically always need triplanar to prevent noticable stretching, whereas a grass texture that is typically painted on mostly-flat areas of the terrain could get by without using tri-planar mode, or it could atleast be disabled for terrains at far distances)
Tri-planar mode has typically been the biggest reason that jme's terrains result in low FPS, so this should allow for some big optimizations when using terrains in large scenes.