Hey all,

I've been learning Godot to create a procedural planet generator. I've been playing around with different approaches including writing GLSL shader code, building an ArrayMesh, etc.

While I've had success with other approaches, the Visual Shader seems like the cleanest and most efficient approach for me. Unfortunately, I've run into a snag since it looks like I can't generate 3D Simplex noise via the Visual Shader interface. Is this a current limitation? Are there plans to add this? 2D Simplex noise doesn't work for the planet since it is causing pinching at the poles.

Thanks in advance!

You are correct that 3D noise is not part of the visual shader by default, but nothing's stopping from either coding the function yourself, or use a function already built in a plugin.

Wow! That is very helpful! Played around with it this morning and still getting some pinching issues at the poles but I'm guessing that's just a mapping problem on my part. At any rate this gives me a good idea how to create my own VisualShader nodes. Thanks!

if you construct yourself a base sphere out of a subdivided cube in a 3D DCC such as blender you'll be able to have a better mapping on it. A UV Sphere isn't great for this, yeah.

To sample the 3D noise properly, don't use the UV coordinates, but the model vertex coordinates as sample points. If use world space vertex coordinates, then the noise won't move with the planet (rotating, scaling, translating).

Yeah, that's a bit more complex but also more powerful/flexible way to go.

@Megalomaniak said: if you construct yourself a base sphere out of a subdivided cube in a 3D DCC such as blender you'll be able to have a better mapping on it. A UV Sphere isn't great for this, yeah.

Never would have thought of that. Thanks!

@SIsilicon28 said: To sample the 3D noise properly, don't use the UV coordinates, but the model vertex coordinates as sample points. If use world space vertex coordinates, then the noise won't move with the planet (rotating, scaling, translating).

I tried multiplying the vertex input by the world transform but it was still behaving as if the vertices were defined in model space. (Also I recognize I should be using 3D noise here but this is a minimum example).

FYI I'm using the built-in SphereMesh and not the imported mesh from Blender.

If you try moving the sphere with that setup, you'll see what I mean.

Sorry I wasn't clear. With the above config, the texture is still behaving as if it is relative to the model space, i.e. when I move the camera the same part of the texture is always facing me.

Figured it out! After a bit of reading, vertices in fragment shader are in VIEW space. Camera is VIEW->WORLD matrix. Further multiply by INV(WORLD) got the vertices in MODEL space.

I also needed to do some extra work with the noise shaders in the ShaderV package. I noticed even with correct verts I was getting some strange texture stretching in the Z-axis. After investigation into the shader code, I noticed that even though it states 3D noise, it only uses the .xy coordinates of the input vector. Changing that to .xyz gave the desired effect.

Thanks everyone for the pointers!

    Also one more follow-up, just discovered the TextureUniformTriplanar node. Didn't even know what triplanar mapping was but turns out to be exactly what I needed. Using a texture to generate the height map to generate the terrain instead of a 3D noise plugin has the added benefit of using the built-in normal map functionality Godot provides.

    2 years later
    10 months later

    UnknownUser pls help me, im newbie and i dont know where and how can i change it from .xy coordinates to .xyz?