Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for FastNoiseLite/NoiseTexture #70919

Merged
merged 1 commit into from
Jan 6, 2023

Conversation

Geometror
Copy link
Member

This PR implements a test suite for the noise module while fixing some minor bugs (primarily with seamless noise generation).

Detailed changes:

  • Implement a test suite for FastNoiseLite and NoiseTexture2D
    • There are some macros and utility function which might be worth to be extracted in test_utils.h or test_macros.h (and generalized), but because they are currently just needed by these tests I left them in test_fastnoise_lite.h
  • Stabilize seamless noise texture generation

There are still some small structural quirks in the noise module (e.g. the private method _generate_texture shouldn't be exposed and rather replaced with another solution, because right know it just returns the generated image without setting it internally so it is generated twice). But that's for another PR.

@TokisanGames
Copy link
Contributor

-ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "seamless_blend_skirt", PROPERTY_HINT_RANGE, "0.05,1,0.001"), "set_seamless_blend_skirt", "get_seamless_blend_skirt");
+ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "seamless_blend_skirt", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_seamless_blend_skirt", "get_seamless_blend_skirt");

Did you verify that values between 0 and 0.05 do something and provide a useful range rather than dead space on the slider? This looks like something I would have cut off if it was useless. But it was a long time ago.

+ fix some issues with seamless noise generation
@Geometror Geometror force-pushed the test-fastnoise-lite branch from 97281b6 to ffb8c74 Compare January 6, 2023 01:48
@Geometror
Copy link
Member Author

Rebased after the copyright header adjustment.
@TokisanGames You mind find values below 0.05 useful when working with large, high-frequency noise textures (since the blend skirt has to be adjusted inversely proportionally to the frequency for it to be the least recognizable, at least for some noise types). 0.05 was just an experimentally/arbitrarily chosen limit because the implementation couldn’t handle values very close to zero initially.

@akien-mga akien-mga merged commit e1ce89a into godotengine:master Jan 6, 2023
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Executing NoiseTexture._generate_texture crashes Godot
3 participants