GithubHelp home page GithubHelp logo

godot_heightmap_module's People

Contributors

zylann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

godot_heightmap_module's Issues

Speed up this module implementation

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.

Can't compile on windows 10

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.

Error while building with clang

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

Error in compiling

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

Impossible to launch a network game when adding a new heightmap data to heightmap node

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!

Texture painting

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!

Compile Error - height_map_editor_plugin.cpp(43): error C2660: 'EditorPlugin::get_icon': function does not take 1 arguments

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.

Collisions

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?

No GetHeightAt(pos) function exposed

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.

Error when starting game with Heightmap

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!

Resources about other terrain systems

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 biased when walking on a high mountain or deep valley

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

Terrain streaming

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

Current state

  • Fully-loaded big texture(s) covering the whole terrain, used to displace vertices and perform shading
  • Geometry LOD using a quadtree-based implementation of clipmaps, tree depth is fully dynamic
  • Having fully-loaded data causes big CPU+GPU stall, consumes a lot of memory
  • Has borders, so the game area is relatively "small" if you want to hide that, unless you do a "crater" arena or islands
  • Physics may use btHeightField at lower res, covering all terrain, or as multiple patches around the player
  • Only uses features exposable by Godot VisualServer (which is itself built on top of GLES3), so fancy stuff like glDrawIndirect or tessellation are not an option (yet?)

Proposal P1: GoogleMap-ish

  • Many textures of 512x512 at multiple LOD levels covering parts of the full terrain, loaded as needed
  • Same geometry LOD, except chunks above a certain size will likely use different textures (which means multiple materials with same shader) and will wait for textures to load before merge/split.
  • Can be loaded progressively without stalls due to small size of textures. Chunks too far away from the far clip will be considered not loaded, so only a part of the quad tree will be in sight.

Proposal P2: Render buffer

  • Similar to P1, except 512x512 textures would be used to render the top-down heightmap to an offscreen buffer, which is in turn used as a texture when rendering the terrain, and re-rendered as the viewer moves.
  • Same geometry LOD, may still use multiple textures if we want to see very far away (atlased renderbuffer at 4 LOD levels? beware of the seams)
  • May use less materials than P1
  • Purely theoretical, I don't know how good this idea would be, I'm not a GPU expert :p

OpenEXR import

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).

Terrain clipping too close

I create a heightmap with a raw file, the terrain is clipping too close and it seams that has to do with the camera pitch, when i watch to the bottom it doesnt clip.

captura de pantalla_2017-11-03_15-46-46

Thanks!

Crash out of boundaries

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.