0 votes

Everywhere I look I see posts on how to generate opensimplex noise within GDScript, but I can't find any on how to generate that noise in a fragment shader. Can anybody help me out?

I would love if somebody could provide just a simple grayscale noise shader using the build in noise function.

in Engine by (51 points)

1 Answer

+3 votes
Best answer

Ok, figured it out myself. You have to create a texture uniform, and then in the node inspector you set that to a new noise texture

uniform sampler2D NOISE_PATTERN;

void fragment(){
    float noiseValue = texture(NOISE_PATTERN, UV).x;
    COLOR = vec4(noiseValue);

The above will simply sample the noise texture and set the color as the output

by (51 points)

It did work in my tests,Thanks for sharing, I will use it to make a 2d water

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.