Open realkotob opened 5 years ago
I think you'll have trouble with physics, a Heightmap collider is used, and it needs to be changed to something entirely different if any overhang is possible, which means StaticBody, which means a mesh is needed, and... that's a bottleneck, to the point you'd need a special baking option :p This plugin does not generate any mesh, which is what made it viable for GDScript while still handling LOD. It works by displacing vertices in the vertex shader from one single mesh repeated many times (thus avoiding generation cost), so displacing vertices slighly differently based on a vector map is the easy part: https://github.com/Zylann/godot_heightmap_plugin/blob/master/addons/zylann.hterrain/shaders/simple4.shader#L88 You would need a 7th kind of map to add everywhere maps are handled, or just re-use the COLOR map, but there is more work to make vector field viable due to every other feature having to take that into account.
@Zylann Ah thank you that explains why I couldn't find the code for mesh generation 😄
It should be straightforward to edit the vertex shader to use vector field for the displacement.
For the physics, I will definitely need a mesh to create the collider but that's doable in the editor I guess and the mesh would be discarded for the game. That also explains why I couldn't find the code where you use pool vector arrays to generate the collision mesh :b
I think I will adapt some code that I need for the shader but will do the physics mesh generation in a separate project instead to keep my sanity 😅
Thank you the help, I'll ping you again later with the demo if you're interested in checking it out.
I'm trying to extend this addon with vector field for terrains similar to the technique in this video (from 5:00 to 15:00 but the whole video is useful info) but I am having trouble navigating the project (figuring out what does what).
I basically want to use an RGBA texture to be able to displace the vertices in 3d space instead of only vertically on one axis like it does currently.
I'm having trouble making sense of all 6? texture channels and knowing which code is for the editor tools and which code handles the heightmap generation from the texture instead of the physics/colors/details. :/
I really only want some hints to know where the main mesh generation is happening and where to load the vector field texture, since the actual displacement code I want to write is very simple: - use r/g/b channels for x/y/z signed direction and use the alpha channel as the vector length and displace according to the resulting vector. The code for splat maps and such probably doesn't need adjusting.