-
Notifications
You must be signed in to change notification settings - Fork 22
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
PBR Terrain Shader + Lighting Rewrite + Triplanar terrain #184
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # commons/src/main/com/mbrlabs/mundus/commons/shaders/terrain.uber.frag.glsl # editor/CHANGES
# Conflicts: # commons/src/main/com/mbrlabs/mundus/commons/Scene.java # commons/src/main/com/mbrlabs/mundus/commons/scene3d/components/TerrainComponent.java
# Conflicts: # commons/src/main/com/mbrlabs/mundus/commons/Scene.java
I retested the runtime with RoBB 3D on both desktop and web and it looks good. |
I've tested on my PoC desktop projects and it looks very good. |
# Conflicts: # commons/src/main/com/mbrlabs/mundus/commons/Scene.java # gdx-runtime/CHANGES
Thanks for testing. I will go ahead and merge. This was the last major change before 0.5.0. If any small bugs pop up they can be fixed down the road. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Large PR full of breaking changes and probably impractical to review it in full. It was not possible to break most of these down into smaller PRs while still being able to build the app.
I have thought about moving the Terrain Shader to use PBR shader for a while. This modifies the custom PBR shader to support terrain splatmaps and to support triplanar texturing. This also improves terrain normal calculations. Makes triplanar PR obsolete. I noticed latest gdx-gltf code has heavily refactored how the glsl code is organized so.. I already know down the road that is going to be a painful migration to update gdx-gltf but will probably be for the best but, one thing at a time.
Now that both Terrain and Models are using PBR, it was time to remove a bunch of Mundus lighting code and refactor things so that we use gdx-gltf and libGDX lighting conventions whereas before it was a mix up of PBR for models and custom lighting for terrains. This was a large and painful refactor but cleans up the code in some ways due to removing a bunch of lighting classes and code.
Terrain and Lighting changes
New Terrain Normals with PBR shading
Old Terrain Shader and Normals
Material Changes
Materials are now represented in the UI in the same way the actually behave. To edit a material, you select the material in the asset dock. You can no longer directly edit a material from a Model Component Widget. Editing a Material from within the Model Widget gives the false impression that you are only editing the material for that single GameObject. Instead, I added a new Edit button that takes you to the current Material to edit it. This makes for a cleaner UI (at the expense of an additional click) and easier to add material to the Terrain Widget as well.
Triplanar specific stuff
Triplanar should work on terrains up to 252 Vertex resolution
Note: Triplanar is not always better, it is situation depending on your terrain. Triplanar is more expensive (more texture sampling) and can look bad with lots of sharp edges close together, etc..
Rendering refactor
I removed rendering logic from GameObject, SceneGraph and Components. Rendering logic was tightly coupled with the data. The goal here is to decouple rendering logic from the data which will allow us to have more flexibility in the future like abstracting rendering out of the scene class and enhanced post processing. Now rendering is all in one place (the scene class) whereas before it was a mess, scattered down from SceneGraph -> GameObject -> Component. Ideally would like to abstract it somewhere else later but I'm trying to keep the PR small.
RenderableComponents only have to provide a RenderableProvider now (aka ModelInstance) and they don't need to know anything else about the rendering logic.
Previously we were using the render methods inside components like an update method, now those actions are moved to the update method which already existed. Another bonus to this move is that components that don't render anything don't need an empty render method anymore (Lights, Properties).