jMonkeyEngine / jMonkeyEngine/jmonkeyengine
Add Occlusion-Parallax mapping to terrain shaders
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 14
Description
As it stands, all of our primary terrain shaders (TerrainLighting.frag, PBRTerrain.frag, AdvancedPBRTerrain.frag) already store a normal map and could have a parllax map easily packed into the alpha channel of this map to keep texture reads low. I actually wrote the advanced PBR terrain shaders so it refers to the normal map as a PackedNormalParallax map for this exact reason.
However, when I tried implementing occlusion-parallax into the PBR shaders, I encountered 2 issues that caused me to put the feature on hold. But hopefully the addition of the tile-deferred rendering will make the optimization issues less severe and can make this feature a real possibility in the core terrain shaders now.
-
I noticed that occlusion-parallax required more than 1 texture read from the same parallax texture, and this seemed to consequentially cause the framerate to tank if I added too many texture-slots to the terrain
-
I did not know what to do if only 1 of the terrain's texture-slots had a parallax map. I tried blending to a parallax value of 0.0 as well as 1.0 for slots with no parallax texture (very similar to how I consider a texture-slot without a unique AmbientOcclusion map to have an AO value of 1.0 for blending purposes). Not sure if this was a mistake on my end, but I'm guessing there is a correct way to do this that I just didn't find.
So I ended up removing the feature from the core PBR terrains (although some parallax code is left commented out in the .fraf file) since it tanked the frame-rate and only worked correctly if every texture-slot had a valid parallax map. But if the terrain's framerate is no longer as big of an issue with the new renderer, then it could be time to finally add this feature to the core terrain shaders.
Any thoughts on this? I know @riccardobl and @oxplay2 (not sure of your @ on here and it didnt auto-fill, my apologies if I tagged you wrong) already have their own implementations of PBR terrains that have occlusion parallax but not a packed metallic-roughness-ao-emissiveIntensity map (I think, correct me if I'm wrong), so I'm interested to hear more on this from you guys.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing TerrainLighting.frag, PBRTerrain.frag, and AdvancedPBRTerrain.frag, including the commented parallax code mentioned in the issue. Investigate the tile-deferred renderer's effect on texture-read cost and how terrain slots behave when only some provide parallax maps. Done means occlusion-parallax works in the core terrain shaders without requiring every slot to have a parallax map or causing unacceptable performance loss.
Written by the indexing model from the issue text.
Assessment
- Domain
- computer-graphics, game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100