-
Notifications
You must be signed in to change notification settings - Fork 20
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
Grid-like artifacts in turbulence_3d. #15
Comments
interesting, I'll double check the turbulence code. Have you taken a look, any ideas? |
Well it doesn't happen in 2d, but does in 3d or 4d, so that is a clue. |
It looks like a bug in the simplex3d/4d itself |
probably related to how I am hashing in grad3d/4d, looking into it |
I like how you update the ticket while debugging. People should make this a habit. |
Any findings? |
I've made some progress, just slow, because life. |
Ok this should be fixed in the 3d case in the latest version and master branch. Let me know how it looks for you, if all is well I'll apply the same process to the 4d case. |
This still happens, but it becomes more pronounced with slightly higher frequency and lower octaves. Code that produces the imageuse minifb::{Key, Window, WindowOptions};
const WIDTH: usize = 2048;
const HEIGHT: usize = 1024;
const FREQ: f32 = 0.125;
const OCTAVES: u8 = 6;
fn get_buffer() -> Vec<u32> {
let noise = simdnoise::NoiseBuilder::turbulence_3d_offset(0.0, WIDTH, 0.0, HEIGHT, 0.0, 1)
.with_freq(FREQ)
.with_octaves(OCTAVES)
.generate_scaled(0.0, 255.0);
noise.iter().map(|x| *x as u32 * 0x00010101).collect()
}
fn main() {
let buffer = get_buffer();
let mut window = Window::new(
"Test - ESC to exit",
WIDTH,
HEIGHT,
WindowOptions::default(),
)
.unwrap_or_else(|e| {
panic!("{}", e);
});
// Limit to max ~60 fps update rate
window.limit_update_rate(Some(std::time::Duration::from_micros(16600)));
while window.is_open() && !window.is_key_down(Key::Escape) {
// We unwrap here as we want this code to exit if it fails. Real applications may want to handle this in a different way
window.update_with_buffer(&buffer, WIDTH, HEIGHT).unwrap();
}
} |
Below is a screenshot from a slice of
turbulence_3d
using default parameters exceptoctaves
, which is set to8
. There are some pretty obvious grid-like artifacts at 45 deg angles. This is not what turbulence is supposed to look like. Call generating the attached image:The text was updated successfully, but these errors were encountered: