Closed kurtkuehnert closed 9 months ago
From quickly skimming it, the approach you took for updating the shaders looks much better than what I tried.
Would it make more sense to just remove the empty fields in TerrainConfig, and anyone who wants to customize it would just need to create an additional uniform binding with a struct containing their custom fields?
Sorry for taking so long with my response to your PR. I am trying to get into the project again, so I created this PR from scratch. Your branch was a big help though.
I will try getting both examples working again by duplicating some code and then I will try to write some code that automatically generates the sampling code for the attachments. I hope that this will reduce the boilerplate quite significantly.
@Elabajaba , @ethereumdegen
May I ask what you are currently using bevy terrain for, so that I can make sure not to restrict the API too much for now.
I just wanted to play with it and see if I could use it to render huge terrains to test out navmesh generation with bevy_pathmesh and oxidized_navigation.
edit: In terms of a wishlist, something like auto-texturing the terrain based on slope and height (with up to some amount (I think unreal used to allow 16?) of user provided textures?), and being able to edit the terrain heightmap at runtime (eg. for editor workflows, not necessarily during gameplay) would be great to have.
@Elabajaba, I see thank you for your response.
Navmesh generation for the terrains would be very valuable.
My current plan is to extend the terrain capabilities to render planets and spherical terrain. Then I will probably experiment with a simple auto-texturing tool. Realtime editing is also high on my wishlist, but developing it will be very complicated and time-intensive. First I would need a faster GPU-based preprocessing system.
Currently, this PR adds back the basic example and pbr support, but custom shaders do not work yet.
Due to the new shader import system, I will have to rethink the user-customizable shaders, before I can merge this PR.
I plan to autogenerate most of the shader code so that writing your own shaders is easier.
I have now implemented some basic attachment shader binding generation. This is still more verbose than the previous version, but things are moving in the right direction.
I think this should be enough for now. Both examples work again, and writing custom shaders is a bit easier as well.
I will leave this PR open till the end of this week.
This PR is not done yet, but at least I have gotten the basic example to display the terrain again.
Currently PR is broken and I have to reevaluate how we go about shader customization.
Massive thanks to @Elabajaba (#7) and @ethereumdegen (#9), for their attempts at migrating to 0.11.