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

Worley noise distance output unexpected. #315

Open
Vixeliz opened this issue Apr 7, 2023 · 1 comment
Open

Worley noise distance output unexpected. #315

Vixeliz opened this issue Apr 7, 2023 · 1 comment

Comments

@Vixeliz
Copy link

Vixeliz commented Apr 7, 2023

image

This is how the normal Euclidian distance(also happens with Euclidian Squared) worley noise looks like. This screenshot is from nannou but ive also experienced the same in my own project using noise-rs. The circles are very annoying. Thanks for the awesome crate

Here is all the relevant code

    let noise: Worley = noise::Worley::default()
        .set_frequency(0.01251051)
        .enable_range(true)
        .set_range_function(noise::RangeFunction::Euclidean);
    let image = image::ImageBuffer::from_fn(1000, 1000, |x, y| {
        let n = noise.get([x as f64, y as f64]).abs() * 256.0;
        nannou::image::Rgba([n as u8, n as u8, n as u8, std::u8::MAX])
    });
```
@Vixeliz
Copy link
Author

Vixeliz commented Apr 7, 2023

Here is the code from my project using latest noise-rs

    let noise = Worley::new(seed)
        .set_frequency(0.01251051)
        .set_distance_function(distance_functions::euclidean_squared)
        .set_return_type(noise::core::worley::ReturnType::Distance);
    for x in 0..=CHUNK_SIZE - 1 {
        for z in 0..=CHUNK_SIZE - 1 {
            for y in 0..=CHUNK_SIZE - 1 {
                let full_x = x as i32 + ((CHUNK_SIZE as i32) * pos.x);
                let full_z = z as i32 + ((CHUNK_SIZE as i32) * pos.z);
                let full_y = y as i32 + ((CHUNK_SIZE as i32) * pos.y);
                noise.get([full_x as f64, full_y as f64, full_z as f64]);

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

No branches or pull requests

1 participant