godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.56k stars 20.73k forks source link

FastNoiseLite.GetImage(normalize: true) morphs on width and height gradual change #93658

Open immorom opened 3 months ago

immorom commented 3 months ago

Tested versions

Found in: v4.2.2.stable.mono.official [15073afe3]

System information

Godot v4.2.2.stable.mono - Windows 10.0.19045 - GLES3 (Compatibility) - GeForce 210 () - Intel(R) Core(TM) i3-10100F CPU @ 3.60GHz (8 Threads)

Issue description

FastNoiseLite.GetImage(normalize: true) resulting image always shifts and morphs while gradually changing width and height parameters of the function. Firstly noticed on C#, then tested on GDScript – the issue remains.

2024-06-2715-33-02-ezgif com-video-to-gif-converter

Setting normalize = false seems to fix the issue, but values are, obviously, not the same as if normalize = true. Drawing the noise by yourself via GetNoise2D() is also problems-free.

(GetNoise2D() with DrawRect() for each point on the left and GetImage(normalize: true) on the right) 2024-06-2710-44-10-ezgif com-crop

Steps to reproduce

For the more noticeable effect you should put 'Project Settings' > 'Rindering' > 'Textures' > 'Default Texture Filter' to 'Nearest'

  1. Create FastNoiseLite with NoiseType = FastNoiseLite.NoiseTypeEnum.Simplex
  2. Create an image using FastNoiseLite.GetImage2D(normalize: true)
  3. Display resulting image in any way (I am using TextureRect with .Texture = ImageTexture.CreateFromImage(<our_result_image>))
  4. Gradually change the width and height of GetImage()
  5. It moves, it's alive!!

For the MRP: The GDScript is attached to Node2D with Threshold: int and Normalize: bool variables. You can check/uncheck Normalize to compare the results.

Minimal reproduction project (MRP)

FastNoiseLite_Demo.zip

AThousandShips commented 3 months ago

Please upload an MRP to make this easier to test:

Also do you mean normalize?

immorom commented 3 months ago

Also do you mean normalize?

Yes, I do. Corrected title and all occurrences in post.

Uploaded MRP.