godot_voxel icon indicating copy to clipboard operation
godot_voxel copied to clipboard

Procedurally Generated Planets

Open Aurin-git opened this issue 4 years ago • 33 comments

Is it possible to make a custom stream that will generate a planet or am is this tool not that flexible?

Aurin-git avatar Dec 04 '20 21:12 Aurin-git

It is possible to generate a planet yes. One of the easiest ways is to use SDF functions: a sphere for the base shape, and layers of 3D noise to create surface features. This is doable with either VoxelGeneratorScript, or VoxelGeneratorGraph. Maybe there are more specialized ways to do it though, which I haven't tried yet.

Here is an example which uses a torus shape instead of a sphere, though the idea is the same: image

Zylann avatar Dec 04 '20 22:12 Zylann

I was able to do it. Thank you for taking the time to help me. I really appreciate it.

Aurin-git avatar Dec 05 '20 01:12 Aurin-git

i cant wrap my head around this xD I wish we could get a video tutorial on making planets and asteroids, im sure im not the only one who's been dying to make space games with voxel tools

spiro-angelakis avatar Feb 28 '21 03:02 spiro-angelakis

It is possible to generate a planet yes. One of the easiest ways is to use SDF functions: a sphere for the base shape, and layers of 3D noise to create relief. This is doable with either VoxelGeneratorScript, or VoxelGeneratorGraph. Maybe there are more specialized ways to do it though, which I haven't tried yet.

Here is an example which uses a torus shape instead of a sphere, though the idea is the same: image

Every time i try copying what you did in that picture, it crashes my instance of godot, even on a new brand new empty project, using either graph or script generators, on both opengl2 or 3

im using the godot3.2.3 version of voxel tools

spiro-angelakis avatar Mar 02 '21 20:03 spiro-angelakis

I'm aware of a bug somewhere, it happens very rarely for me so I was not able to find what it was yet. One occurrence was reported in https://github.com/Zylann/godot_voxel/issues/216 but the code has changed a lot since (and the clamp node was fixed). I think it's a known assertion though, it's not a random crash, so having a log showing the error message might help (or better, the call stack)

Zylann avatar Mar 02 '21 20:03 Zylann

I figure maybe this is a bug fixed in newer branches? I've been trying to get the master branch of voxel tools all day and cant figure out what branch of godot it will successfully build with

spiro-angelakis avatar Mar 03 '21 01:03 spiro-angelakis

with the 3.2.3 version of godot & voxel tools, no matter how i try to go about it, even if stream in editor is false, graph crashes the editor immediately whenever a noise or sdf node is connected to outputsdf

spiro-angelakis avatar Mar 03 '21 02:03 spiro-angelakis

trying my best to understand, im pretty sure the only way id achieve voxel ore chunks underneath voxel terrain, as well as asteroid fields in space, would be through using voxelgraphs

spiro-angelakis avatar Mar 03 '21 02:03 spiro-angelakis

... I think it's a known assertion though, it's not a random crash, so having a log showing the error message might help (or better, the call stack)

if youre asking for a crash report i have no idea where godot would save them if it does generate them

spiro-angelakis avatar Mar 03 '21 02:03 spiro-angelakis

The module uses the latest of Godot 3.2 branch to build.

I don't know myself how people get call stacks from release_debug versions (the kind of build used by official versions and the CI of my repo), but there should be a message printed in the system console when that happens. Maybe you could try running Godot from a command line so it won't close right away?

Is there a very specific series of steps you are doing to reproduce the crash?

Zylann avatar Mar 03 '21 02:03 Zylann

Is there a very specific series of steps you are doing to reproduce the crash?

yes, anything connecting to an outputSDF node crashes the editor, meaning i dont think i can use any of the custom gen functionality

spiro-angelakis avatar Mar 06 '21 03:03 spiro-angelakis

anything connecting to an outputSDF node crashes the editor

I tried that, didn't crash.

https://user-images.githubusercontent.com/1311555/110208187-86a77580-7e7f-11eb-8c19-38e862cdfbc6.mp4

Zylann avatar Mar 06 '21 13:03 Zylann

Okay so I guess its just when i connect a 3dGenerator node to an outputSDF

spiro-angelakis avatar Mar 06 '21 19:03 spiro-angelakis

no matter what, having a 3dGen connected in the chain to outputSDF, it immediately crashes

spiro-angelakis avatar Mar 06 '21 19:03 spiro-angelakis

What is a 3dGenerator? I tried with Noise3D, did not get a crash.

https://zylannprods.fr/dl/godot/voxel/issue219_0.mp4

Zylann avatar Mar 06 '21 19:03 Zylann

What is a 3dGenerator? I tried with Noise3D, did not get a crash.

https://zylannprods.fr/dl/godot/voxel/issue219_0.mp4

Im really not trying to be a pest here, sorry, just really want help so I can use the full potential of this awesome module Why does it crash the editor for me? Is there anything I can do, did I build the module into godot wrong? I really dont understand what I could be doing wrong

spiro-angelakis avatar Mar 11 '21 22:03 spiro-angelakis

I appreciate the replies sorry I will try running from a command line to get you some sort of error at least

spiro-angelakis avatar Mar 11 '21 22:03 spiro-angelakis

At: modules\voxel\generators\graph\voxel_graph_runtime.cpp:748 ERROR: The graph has no SDF output

it spammed this like a thousand times before the crash as soon as a Noise3D was connected to an OutputSDF node

spiro-angelakis avatar Mar 11 '21 23:03 spiro-angelakis

this is the only other info cmd provided:

Godot Engine v3.2.3.stable.custom_build - https://godotengine.org -------- VoxelMemoryPool ----------

C:\Users\Angel\HDD Documents\GODOT>OpenGL ES 3.0 Renderer: GeForce GTX 560 Ti/PCIe/SSE2

spiro-angelakis avatar Mar 11 '21 23:03 spiro-angelakis

At: modules\voxel\generators\graph\voxel_graph_runtime.cpp:748 ERROR: The graph has no SDF output

Strange, voxel_graph_runtime.cpp only has 654 lines, line 748 does not exist. Maybe you're not using latest version?

Based on the message, it could be either line 501 or line 603. It means the graph is being executed while it's not in a valid state. Looks like a bug coming from the graph editor, but I need to know more precisely how you are making this happen, because when I try, it does not happen. If needed, reproduction steps should start from the moment you launch Godot to the moment it crashes, without using pre-existing scenes or resources, because I don't have them myself when I reproduce the steps.

Zylann avatar Mar 11 '21 23:03 Zylann

I've tried Noise3D and it doesn't crash on my machine, but doesn't work either. When I use FastNoise3D I get it working in the editor. However, when I start the game itself, nothing shows. Screenshot from 2021-03-21 17-03-47

creative-brain avatar Mar 21 '21 16:03 creative-brain

Your scene is missing VoxelViewer under the camera, maybe that's why you don't see it in game?

Zylann avatar Mar 21 '21 17:03 Zylann

That solved the problem. Thanks!

creative-brain avatar Mar 21 '21 19:03 creative-brain

I think there might be a bug in SdfSphere - it produces weird artifact on each face (see the image bellow). Any idea what can cause this?

Screenshot from 2021-03-22 15-37-07

creative-brain avatar Mar 22 '21 14:03 creative-brain

That graph should not produce a bug like this. Do you also get the artifacts if you remove the Constant, and instead assign the radius on the default inputs of the SdfSphere node?

Zylann avatar Mar 22 '21 14:03 Zylann

Event with the radius on the default inputs of the SdfSphere node it still produces artifacts. I also tried SdfSphereHeightmap and it just did the same thing.

creative-brain avatar Mar 22 '21 15:03 creative-brain

Do you still get it if you remove the Add node and connect directly the sphere node to OutputSDF? Also, do you get a dent inside the geometry? Or is it only the shading that looks like that?

Zylann avatar Mar 22 '21 15:03 Zylann

I've re-create the issue again with x,y,z inputs, a plain SdfSphere with radius set to 100 and OutputSdf. The artifact looks like dent inside the geometry - see the image.

Screenshot from 2021-03-22 16-30-30

creative-brain avatar Mar 22 '21 15:03 creative-brain

I may have a look later but I think I know what that is. try to increase that 0.2f constant here: https://github.com/Zylann/godot_voxel/blob/fe968f17aa6d1e08e5565d237a3fa94bdd2bbdb6/generators/graph/voxel_generator_graph.cpp#L231 It's going to be exposed as a property soon

Zylann avatar Mar 22 '21 15:03 Zylann

I've recompiled godot with the plugin using values 0.5f and 1.0f but the dent is still there. Also I've noticed that when I change the LOD_split_scale to a higher value (4 or 5) the dent gets smaller.

Screenshot from 2021-03-22 16-53-24

creative-brain avatar Mar 22 '21 15:03 creative-brain