Open SlashScreen opened 1 year ago
Cool. Microverse looks interesting.
Yes. Look at importer.gd which imports user files into the terrain via gdscript.
you mean via img = Terrain3DStorage.load_image(height_file_name, ResourceLoader.CACHE_MODE_IGNORE, r16_range, r16_size)
(line 62)? Also, the brush tool must only update a region, right? I'd like to be able to offer real-time feedback in the editor as the user drags the stamps around. How bad of an idea would it be to import an entire new heightmap as the user drags the stamp around, or would it only be possible if I were to calculate diffs somehow between the old heightmap and the new and only update that region? I know that's the Proper way to do it, but that's difficult.
Look at the online help in godot (Shift+F1) for Terrain3DStorage or look at the functions exposed in _bind_methods here: https://github.com/outobugi/Terrain3D/blob/d42c79a47db40db9c2dfce2eedf822ec3203b8df/src/terrain_3d_storage.cpp#L1563
load_image
loads a file off disk and returns an image.
import_images
receives an image in memory and places it on the terrain. You can import as small as one 1k region. It currently expects a full set of height/color/control maps though they can be null, and it overwrites what is there. We can change that to only import what is provided leaving the unspecified maps (#130).
get/set_map_region
will allow you to retreive and set a 1k region image at a time. If you're going to do it non-destructively you'll have to retain what was there before. Our sculpt tools work on whatever is in these images. It will be challenging to do it this way.
Also you need to work across region boundaries.
It will probably be easier to incorporate a non-destructive data layer in C++ for stamps and curves by design.
Currently on each edit update, we consolidate all heightmaps into one array to be sent to the shader.
Non-destructive editing could look like this:
Data is sent to the GPU here?
Yes, for the height/control/color maps. Actually sent when we set the material parameter.
is there any date when this would be available in the plugin?
Whenever someone needs it and implements it. We don't need it for Out of the Ashes, so it's not on my personal task list anytime soon. There are far more pressing issues. I can provide guidance.
I have a somewhat-functional tool for nondestructive terrain editing using stamps, similar to that of the Microverse unity plugin, currently interfacing (buggily) with HTerrain. It generates a heightmap as the process' output. Could there be ways to set regions / update an entire heightmap from GDScript?