Skip to content

Conversation

@yaRnMcDonuts
Copy link
Member

@yaRnMcDonuts yaRnMcDonuts commented Feb 1, 2025

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.

@yaRnMcDonuts
Copy link
Member Author

yaRnMcDonuts commented Feb 1, 2025

@capdevon
I believe I've addressed most of your review, let me know if I missed anything.

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.

@yaRnMcDonuts yaRnMcDonuts merged commit 7e2f336 into master Feb 3, 2025
15 checks passed
@stephengold stephengold added this to the v3.8.0 milestone Feb 23, 2025
@yaRnMcDonuts yaRnMcDonuts deleted the yaRnMcDonuts-patch-4 branch February 24, 2025 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants