Skip to content

Worley 2D#15

Merged
johanhelsing merged 16 commits into
johanhelsing:mainfrom
vladinator1000:worley
Feb 22, 2025
Merged

Worley 2D#15
johanhelsing merged 16 commits into
johanhelsing:mainfrom
vladinator1000:worley

Conversation

@vladinator1000

@vladinator1000 vladinator1000 commented Jan 14, 2025

Copy link
Copy Markdown
Contributor

Heya @johanhelsing , I love this crate! I'm working on a Worley implementation, it's almost there but I have some strange issues. This is the rendered output of this example:

$env:WGPU_BACKEND="dx12"; cargo run --example worley

I'm developing on windows and added the wgpu backend env var to reduce console warnings.

worley_ERLTzJemo2

I used this repo for inspiration: https://github.com/bevy-interstellar/wgsl_noise/blob/main/worley_vec2f.wgsl

Do you see where I'm making a mistake here? Looks like it doesn't handle negative coordinates well, because when x and y are positive (top right) there are no visual issues.

@vladinator1000

vladinator1000 commented Jan 14, 2025

Copy link
Copy Markdown
Contributor Author

Turns out glam's fract implementation is different: https://docs.rs/glam/latest/glam/f32/struct.Vec3.html#method.fract

I used fract_gl and it worked! Should be good for review now @johanhelsing.

On the CPU:

worley_czxM3hfQIA

The only thing that bothers me is that we use value.y in the CPU demo it looks quite funky. Is it supposed to do that?

image

The shader example looks pretty cool though:

worley_shader_pKrcgZ6I5R

@vladinator1000 vladinator1000 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review notes

Comment thread README.md
Comment thread examples/README.md
@vladinator1000

Copy link
Copy Markdown
Contributor Author

Added mouse input to the example

2025-01-14.17-41-42.mp4

@johanhelsing johanhelsing left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, sorry for the slow response.

Did you check if it it produces similarish values on the CPU and GPU?

Comment thread assets/noisy_bevy.wgsl Outdated
Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
@vladinator1000

vladinator1000 commented Feb 8, 2025

Copy link
Copy Markdown
Contributor Author

Thanks @johanhelsing, addressed your comments, but the CPU and GPU values look different and I'm not sure how to fix that.

CPU version $env:WGPU_BACKEND="dx12"; cargo run --example worley

worley_SZKlDEfFbM

GPU $env:WGPU_BACKEND="dx12"; cargo run --example worley_shader

worley_shader_1Trhok36IR

Comment thread src/lib.rs Outdated
@johanhelsing

Copy link
Copy Markdown
Owner

It's a bit unfortunate that we break the promise that gpu and cpu-noise are the same... It would be awesome if we could figure out what's causing the difference.

@johanhelsing johanhelsing left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pretty closely at the two versions side-by-side, but couldn't find anything obvious causing the discrepancies :/ Guess maybe we'll have to go line-by-line and figure out what causes it

Comment thread README.md Outdated
@johanhelsing

Copy link
Copy Markdown
Owner

Turns out they're quite similar after all. I modified the examples quite heavily to make sure the inputs were the same, and they look similar.
image

@johanhelsing

Copy link
Copy Markdown
Owner

Cleaned up the changes and made PR to your branch: vladinator1000#1

Merge that and revert the changes that break the doc links, and this should be good to go :)

@vladinator1000

Copy link
Copy Markdown
Contributor Author

Wow, thanks @johanhelsing, turns out it was almost there ❤️ I fixed the docs.

@johanhelsing johanhelsing left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is a really cool addition. Thanks for sticking around even though my responses have been far in-between!

@johanhelsing johanhelsing merged commit dbe3801 into johanhelsing:main Feb 22, 2025
@vladinator1000 vladinator1000 mentioned this pull request Feb 22, 2025
3 tasks
@vladinator1000 vladinator1000 deleted the worley branch February 22, 2025 16:21
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

Successfully merging this pull request may close these issues.

2 participants