0 votes

I wonder if it's possible to have NoiseTexture use a custom-defined noise instead of OpenSimplexNoise. I tried inheriting OpenSimplexNoise and overriding get_image and get_seamless_image:

tool
extends OpenSimplexNoise
class_name CustomNoise

export var brightness := 1.0

func get_seamless_image(size : int) -> Image:
    var img = Image.new()
    img.create(size, size, false, Image.FORMAT_L8)
    img.lock()
    for x in size:
        for y in size:
            img.set_pixel(x, y, Color(brightness, brightness, brightness))
    img.unlock()
    return img

And it works, kind of, but not actually. I can choose it in editor as a noise source for NoiseTexture and even see the added export value. However, the function calls aren't overridden, resulting in original noise.

I know I could just make a script which creates images runtime, but I'd appreciate the possibility to preview it in the editor. In addition to that, NoiseTexture offers normal map creation, another feature I'd use.

Godot version 3.4.rc3
in Engine by (382 points)

Please log in or register to answer this question.

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.