Zylann / godot_voxel

Voxel module for Godot Engine
MIT License
2.59k stars 244 forks source link

Generate terrain from image #589

Open JJDelisle opened 8 months ago

JJDelisle commented 8 months ago

cannot for the life of me understand the difference between these two images or why one works but the other doesn't. Doesn't work: ant5 Works: noise_distorted

JJDelisle commented 8 months ago

i handle them exactly the same, they are the same format, they also are the same size. I am using tokisan games build of voxeltools in godot 3.2.2

JJDelisle commented 8 months ago

Its just ignoring my image. why? not loading an image at all yields the same result

Zylann commented 8 months ago

What do you mean by "doesnt work"? What is actually happening as you do things? What terrain type are you using? Which mesher? Which settings? There aren't enough details in your posts. They should both work, only yours has a lot of black in it, so there will be a bunch of terrain very deep below (maybe out of viewing range depending on your configuration).

I loaded your image and this is what I see with the Transvoxel mesher: image Moving a little while along positive axes, I see this: image

The Tokisan builds are no longer maintained. They might still work, but they are very old and no more updates are coming for Godot 3.

Shot in the dark: I dont remember what Godot 3 does in this case, but VoxelGeneratorImage expects an Image resource. This is not how Godot imports PNG files by default. Instead, it imports them as Texture2D. Therefore, even if the filename ends with .png, when you choose one, it might not be an Image, so the property will remain empty (Godot just doesnt warn at all, it just does nothing). If that's the case, you have to change the import type in the Import dock.

JJDelisle commented 8 months ago

Imported the images, turned them to image and not texture, and used voxelgeneratorimage to generate it with type channel. the image i included works as expected but i cannot get my image to work

JJDelisle commented 8 months ago

and the result is indistinguishable from not loading an image at all

Zylann commented 8 months ago

Sorry I can't help you without more information than that. Everytime I test your image, it just works.

At this point you should provide a minimal test project that shows your problem. However, you would have to switch to Godot 4, because I no longer work on Godot 3 and the version you're using is outdated.

JJDelisle commented 8 months ago

I tweaked some settings and actually got something similar to the first result you showed, which looks somewhat like noise. what did you do to achieve the second image?

Zylann commented 8 months ago

As I said, I just moved further the editor camera away from the origin towards positive axes. To see this in the editor, you have to keep the terrain selected and enable the "Stream follow camera" option in the Terrain menu on top of the 3D view. Otherwise you may do it in game.

image

As for the "noise", it is present in your image, here is it with contrast enhanced: image