zylann / godot_heightmap_module Goto Github PK
View Code? Open in Web Editor NEWHeightmap module for Godot Engine 3.0 [NO LONGER_MAINTAINED]
License: Other
Heightmap module for Godot Engine 3.0 [NO LONGER_MAINTAINED]
License: Other
Hey,
Currently I am making a large multi terrain game world. I am using multiple height maps one for each terrain I am making.
Does this height map module support importing multiple height maps?
Hi @Zylann I'm writing you here because I want help you in order to speed up the process of implementing this new feature.
Please let me know what you have to do to complete it so I can help you.
I realized that the off-by-one required in terrain textures could become dreadful for VRAM usage, because it makes them non-power-of-two (NPOT). On graphics card, NPOT textures may be upscaled to fit the next power of two, and big terrains could end up occupying 4 times more memory to fit that 1-pixel padding...
Explanation about the 1-pixel padding: https://github.com/Zylann/godot_heightmap_module/blob/master/height_map_data.cpp#L22
It's possible to avoid LOD "popping" with geomorphing, as explained in this article: http://www.gamasutra.com/view/feature/192007/sponsored_the_world_of_just_cause_.php?print=1
GLES3 features should be enough to do this, instead of the stupid technique currently implemented in the progressive_lod
branch
I'm trying to compile this module but i'm facing this error:
scons: Reading SConscript files ...
Detected MSVC compiler: amd64_x86
Compiled program architecture will be a 32 bit executable. (forcing bits=32).
YASM is necessary for WebM SIMD optimizations.
WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!
Checking for C header file mntent.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
[Initial build] �[94mCompiling �[95m==> �[93mmodules\register_module_types.gen.cpp�[0m
register_module_types.gen.cpp
modules\register_module_types.gen.cpp(61): error C3861: 'register_godot_heightmap_module_types': identificatore non trovato
modules\register_module_types.gen.cpp(158): error C3861: 'unregister_godot_heightmap_module_types': identificatore non trovato
scons: *** [modules\register_module_types.gen.windows.tools.32.obj] Error 2
scons: building terminated because of errors.
I got this error while building with llvm:
modules/hterrain/height_map.cpp:232:36: error: expected '(' for function-style
cast or type construction
for_all_chunks(EnterWorldAction { world });
~~~~~~~~~~~~~~~~ ^
modules/hterrain/height_map.cpp:241:42: error: expected '(' for function-style
cast or type construction
for_all_chunks(TransformChangedAction { &world_t...
~~~~~~~~~~~~~~~~~~~~~~ ^
modules/hterrain/height_map.cpp:247:43: error: expected '(' for function-style
cast or type construction
for_all_chunks(VisibilityChangedAction { visible });
~~~~~~~~~~~~~~~~~~~~~~~ ^
You should use a Constructor for those Actions as you do in height_map_brush.cpp
for Operations with more than one input.
I add patches with the changes I did
patches.zip
Hi,
I've tried to compile godot alpha 3 (downloaded version on 13 August), but I get this error on your module:
modules/hterrain/height_map_brush.cpp:168:8: error: implicit default constructor for 'OperatorAdd' must explicitly initialize the reference member '_im' struct OperatorAdd { ^ modules/hterrain/height_map_brush.cpp:169:9: note: declared here Image &_im; ^ modules/hterrain/height_map_brush.cpp:362:14: note: implicit default constructor for 'OperatorAdd' first required here OperatorAdd op { **im_ref }; ^ modules/hterrain/height_map_brush.cpp:362:16: error: expected ';' at end of declaration OperatorAdd op { **im_ref }; ^ ; 2 errors generated.
Any suggestions?
Thanks in advance.
-j
I have a test scene with network managing (based on some demos code because I'm trying to learn :)), scene loading is working fine using a MeshInstance of an .obj , but if I replace it with a heightmap node, it won't load anymore if I add a new heightmap data to it, with this error :
drivers/unix/stream_peer_tcp_posix.cpp:275 - Server disconnected!
I figured out how to get working the vertex painting and i wanted to make a height lerp vertex painting, but i haven't access to the shader params, so i moded the plugin to expose the ShaderMaterial instead of the Shader. I dont know how is going to be implemented to let the user make the vertex color blending, its correct to expose the ShaderMaterial?
Sorry for my bad english!
OS - windows 7 32bit
Godot version - 3.x Dec 8, 2017
Issue - compile error
Can compile without hterrain module - yes, no errors
Can compile with hterrain module - no, error at height_map_editor_plugin.cpp
c:\godot>scons -j6 platform=windows tools=yes target=release_debug
scons: Reading SConscript files ...
Detected MSVC compiler: x86
Compiled program architecture will be a 32 bit executable. (forcing bits=32).
YASM is necessary for WebM SIMD optimizations.
WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits o
r platform are supported!
Checking for C header file mntent.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
[ 6%] ←[94mCompiling ←[95m==> ←[93mmodules\register_module_types.gen.cpp←[0m
[ 6%] register_module_types.gen.cpp
[ 17%] ←[94mCompiling ←[95m==> ←[93mmodules\hterrain\height_map.cpp←[0m
[ 17%] ←[94mCompiling ←[95m==> ←[93mmodules\hterrain\height_map_brush.cpp←[0m
height_map.cpp
[ 17%] ←[94mCompiling ←[95m==> ←[93mmodules\hterrain\height_map_chunk.cpp←[0m
[ 17%] height_map_brush.cpp
[ 17%] ←[94mCompiling ←[95m==> ←[93mmodules\hterrain\height_map_data.cpp←[0m
height_map_chunk.cpp
[ 17%] ←[94mCompiling ←[95m==> ←[93mmodules\hterrain\height_map_editor_panel.cpp
←[0m
height_map_data.cpp
height_map_editor_panel.cpp
[ 18%] ←[94mCompiling ←[95m==> ←[93mmodules\hterrain\height_map_editor_plugin.cp
p←[0m
height_map_editor_plugin.cpp
[ 18%] ←[94mCompiling ←[95m==> ←[93mmodules\hterrain\height_map_mesher.cpp←[0m
height_map_mesher.cpp
[ 18%] ←[94mCompiling ←[95m==> ←[93mmodules\hterrain\quad_tree_lod.cpp←[0m
quad_tree_lod.cpp
[ 18%] ←[94mCompiling ←[95m==> ←[93mmodules\hterrain\register_types.cpp←[0m
modules\hterrain\height_map_editor_plugin.cpp(43): error C2660: 'EditorPlugin::g
et_icon': function does not take 1 arguments
modules\hterrain\height_map_editor_plugin.cpp(44): error C2660: 'EditorPlugin::g
et_icon': function does not take 1 arguments
modules\hterrain\height_map_editor_plugin.cpp(45): error C2660: 'EditorPlugin::g
et_icon': function does not take 1 arguments
modules\hterrain\height_map_editor_plugin.cpp(46): error C2660: 'EditorPlugin::g
et_icon': function does not take 1 arguments
modules\hterrain\height_map_editor_plugin.cpp(47): error C2660: 'EditorPlugin::g
et_icon': function does not take 1 arguments
modules\hterrain\height_map_editor_plugin.cpp(48): error C2660: 'EditorPlugin::g
[ 18%] ←[94mCompiling ←[95m==> ←[93mmodules\hterrain\resources.gen.cpp←[0m
modules\hterrain\height_map_editor_plugin.cpp(49): error C2660: 'EditorPlugin::g
et_icon': function does not take 1 arguments
register_types.cpp
scons: *** [modules\hterrain\height_map_editor_plugin.windows.opt.tools.32.obj]
Error 2
resources.gen.cpp
scons: building terminated because of errors.
Sorry for feature requesting, but don't get me wrong i'm not requesting features, i just want to help and get involved with this module.
Are something about collisions developed? Bullet has its own Heightfield terrain shape that can be requested to godot if it isn't implemented yet, what do you think about this topic?
I thought I'd try setting the player position to the terrain height as a workaround for the collider stuff not being fully finished yet, but I realised there's no GetHeightAt function exposed yet.
Title. Just trying to run a scene with a heightmap node will do it. Tried adding a default HeightMapData and editing but it does nothing. This is on godot's 3.0.1-stable branch (also reproduced on master from a few hours ago). This is the terminal output:
Running: /mnt/DataHDD/code/tools/godot/bin/godot.x11.tools.64 --path /mnt/DataHDD/code/games/Test1 --remote-debug 127.0.0.1:6007 --allow_focus_steal_pid 17942 --position 2368,240
OpenGL ES 3.0 Renderer: GeForce GTX 970/PCIe/SSE2
ERROR: operator[]: FATAL: Index p_index=0 out of size (size()=0)
At: core/vector.h:138.
handle_crash: Program crashed with signal 4
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /usr/lib/libc.so.6(+0x348e0) [0x7f313f4bc8e0] (??:0)
[2] Vector<HeightMapChunk*>::operator[](int) (??:0)
[3] Grid2D<HeightMapChunk*>::set(int, int, HeightMapChunk*) (??:0)
[4] Grid2D<HeightMapChunk*>::set(Point2i, HeightMapChunk*) (??:0)
[5] HeightMap::_make_chunk_cb(Point2i, int) (??:0)
[6] HeightMap::s_make_chunk_cb(void*, Point2i, int) (??:0)
[7] QuadTreeLod<HeightMapChunk*>::make_chunk(int, Point2i) (??:0)
[8] QuadTreeLod<HeightMapChunk*>::make_chunks_recursively(QuadTreeLod<HeightMapChunk*>::Node&, int) (??:0)
[9] QuadTreeLod<HeightMapChunk*>::update(Vector3) (??:0)
[10] HeightMap::_process() (??:0)
[11] HeightMap::_notification(int) (??:0)
[12] HeightMap::_notificationv(int, bool) (??:0)
[13] Object::notification(int, bool) (??:0)
[14] SceneTree::_notify_group_pause(StringName const&, int) (??:0)
[15] SceneTree::idle(float) (??:0)
[16] Main::iteration() (??:0)
[17] OS_X11::run() (??:0)
[18] /mnt/DataHDD/code/tools/godot/bin/godot.x11.tools.64(main+0xd5) [0x558071bf45cf] (??:0)
[19] /usr/lib/libc.so.6(__libc_start_main+0xea) [0x7f313f4a8f4a] (??:0)
[20] /mnt/DataHDD/code/tools/godot/bin/godot.x11.tools.64(_start+0x2a) [0x558071bf441a] (??:0)
-- END OF BACKTRACE --
Nothing read: Connection reset by peer
ERROR: read: Server disconnected!
I'm making this thread to reference useful info about other terrain systems. May not always be doable in Godot 3.0 (GLES3) while keeping the tool simple, but it's a good source of inspiration:
Just Cause 2:
https://www.gamasutra.com/view/feature/192007/sponsored_the_world_of_just_cause_.php
Megaterrain, 32km across, layer types, streaming from CD, geomorphing, clipmaps
Witcher 3:
http://www.gdcvault.com/play/1020197/Landscape-Creation-and-Rendering-in
Megaterrain, more than 16km across, two splat layers (background and overlay), clipmaps, many twists, avoids discard
to make holes
Lumix Engine:
https://github.com/nem0/LumixEngine
Classic heightmap, one splat layer using texture arrays, satellite map for far away terrain, uses CLOD
Texture blending trick:
https://www.gamasutra.com/blogs/AndreyMishkinis/20130716/196339/Advanced_Terrain_Texture_Splatting.php
Use alpha as depth to blend detail textures, looks similar to Witcher 3 overlay technique
--> Implemented in the 3.x plugin
Farcry 5 terrain system:
https://drive.google.com/file/d/1H6ouhi96pLg8WDlwXSGHFupPyZDv2MF6/view
10x10km, similar to what the module does, but also implements streaming to handle such a large size and most of it happens on GPU instead. The more I see those techniques the more I think Godot should support compute + scriptable rendering pipeline, it's frustrating :p
Also outputs NaNs in vertex positions to create holes instead of fragment discard!
Uses ID+weight splatmaps, and optimize amount of texture fetches and do displacement decals by using... virtual textures??
Also use the heightmap to bend tree roots and stuff placed on the ground
LOD is distance-based, but the distance from "sea-level" is also taken into account, as a result if you sit on top of a mountain, that mountain won't have max LOD because your distance from sea-level is high.
LOD should use the actual height as reference. (just ignoring altitude wouldn't work because you could be flying)
Also the 0.5 addition to target the center of a chunk seems to be wrong too https://github.com/Zylann/godot_heightmap_module/blob/master/quad_tree_lod.h#L175
Because origin
is scaled already
Streaming terrains is very nice to have, considering that terrains take up a LOT more memory than tilemap or gridmap-based terrains. Supporting this allows to design large open-worlds, or even "infinitely" generated worlds. We should be able to choose any view distance, and any precision under player's feet.
Ideally it should allow the terrain system to scale gracefully for both small or huge worlds.
Geometry LOD is working good already, the bottleneck is the data itself (textures).
For external resources, see #15
This format is supported in Godot through tinyexr, it needs some glue so that we can use EXR images as heightmaps (export from WorldMachine or image editing software).
Hello, I would like to let you that Godot crashes when modeling tools (add, sub, etc.) come out of the boundaries of the terrain.
Thanks.
-j
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.