-
-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to use this plugin for runtime procedural terrain generation #76
Comments
It should be usable for that but I need more information about what you actually need to do. |
I was also looking for infinite procedural terrain in godot. I want to use a seed and generate more terrain as the player moves further out.
I haven't really tried anything yet. |
It is possible to generate the terrain on the fly in game, by generating images of the correct format, and storing them in |
It would be nice if you could pass 2d arrays of floats to a helper and it would return an image. Would also be cool to pass in arrays for detail and splat maps too, though splats would be harder to generate |
I think you can do that with the
Just use images, arrays will allocate too much memory and |
I am meaning helpers that would generate the images for you with the given data, which would be useful when you’re generating terrain completely in code |
@GammaGames what kind of helper are you thinking about in code terms? |
Just a few helpers that would create the images for users, like:
I'm not really sure what the |
Apart from doing
This one too,
Still makes no sense. A splatmap doesn't need
Same.
Global albedo is a baked texture used to tint grass and replace textures at very large distances or minimaps (to hide repeating patterns that are too far away anyways). It is computed from the result of the ground shader, so if you want to generate that one procedurally you either need to use the same shader, or somehow calculate an approximation on th CPU. It's not always needed though, so the plugin doesn't bake it by default. Currently I think you don't even need |
So what would happen if, instead of passing in values from 0 to 1 , you passed in values from -100 to 100? Or 0 to 255? The min and max are just helpers so that the function can
I think you are missing the point. Using images as data structures when generating data is not user friendly. Yes, users can create their own functions and generate the images themselves, but having static helper functions built in would make the barrier for generating terrain through code that much simpler. |
They will be -100 to 100, or 0 to 255. The format of the heightmap is designed to allow these ranges, it's not an 8-bit image.
It doesn't need to because when you use the
But then why would it need to be solved in this plugin then? Even if I provided such helpers they would be really slow, that's a GDScript plugin and I rely solely on Godot's API to run the fast parts. If There is almost no difference between these two methods: # With an array
array.resize(resolution * resolution)
for y in resolution:
for x in resolution:
var i = x + y * resolution
array[i] = *generate height*
# Then later you have to convert the whole array into an image which doubles your overhead # With an image
im.lock()
for y in resolution:
for x in resolution:
im.set_pixel(x, y, Color(*generate height*, 0, 0))
im.unlock() The first one is just slower and uses more memory. |
You still aren't understanding the point. This was never a question about which was the fastest, it is obvious directly setting pixels on an image would be the fastest. This is about making it easier to generate these images directly with code. Let's just take your own quote from above:
Instead of requiring the user to create images and modify them directly, they could generate their terrain data (add erosion, different passes for biomes and types of terrain, etc) and use the function to generate the texture for them. |
@GammaGames sure, but I don't believe that avoiding |
FYI I added an article about procedural generation using GDScript: https://github.com/Zylann/godot_heightmap_plugin/blob/master/addons/zylann.hterrain/doc/main.md#procedural-generation-from-a-script |
@Zylann is it possible to use the brushes from a script? |
Not directly at the moment. Maybe they can with some changes, since the plugin uses the same features available at runtime to paint, it is just only setup this way in editor. |
Is it possible to use this plugin for runtime procedural terrain generation?
Is there some eechanism for me to use runtime-generated height data and other data to build terrain using this plugin? I was implementing my own terrain building system for procedural world, but I thought I could ask if I could make my work simpler...
The text was updated successfully, but these errors were encountered: