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

Examples: WebGPU GPGPU Birds #29081

Merged
merged 15 commits into from
Aug 13, 2024
Merged

Conversation

cmhhelgeson
Copy link
Contributor

@cmhhelgeson cmhhelgeson commented Aug 8, 2024

Description

A port of the GPGPU birds sample to WebGPU Compute shaders. We already have a fair amount of compute shaders, but I figured it wouldn't hurt to port this one over as well. Having a 1 to 1 port of an old shader could also help with migration purposes. There's also some areas of the code that can be simplified, like the attraction code, which seems to take unnecessary steps to bring cosine output into a [-0.5, 0.5] range. Code is currently WIP and will be ready when undrafted. There's also so

GPGPU.Birds.mp4

examples/webgpu_compute_birds.html Fixed Show fixed Hide fixed
examples/webgpu_compute_birds.html Fixed Show fixed Hide fixed
@cmhhelgeson cmhhelgeson changed the title Webgpu gpgpu birds Examples: WebGPU GPGPU Birds Aug 8, 2024
@cmhhelgeson
Copy link
Contributor Author

cmhhelgeson commented Aug 8, 2024

I think there's still some issues with the velocity code for some reason. Is there anyway to output the shader code built by the NodeBuilder without explicitly modifying the WGSLNodeBuilder class with console calls?

EDIT: I've also changed the color output a bit to reflect the fact that lighting can be integrated with the colorNode, and added calls to the UniformNode.label() function as I think it might be helpful to surface some of the debug capabilities of the node systems for website readers, even if there is a negligible impact on the effectiveness of the shader itself. The original shader had both a call to update the fragment shader for the birds and commented out test code, so I think this is in keeping with the original sample.

@sunag sunag added this to the r168 milestone Aug 9, 2024
@cmhhelgeson cmhhelgeson marked this pull request as ready for review August 12, 2024 00:27
@Mugen87 Mugen87 merged commit 410f737 into mrdoob:dev Aug 13, 2024
11 checks passed
@cmhhelgeson cmhhelgeson deleted the webgpu_gpgpu_birds branch August 13, 2024 16:14
@RenaudRohlinger
Copy link
Collaborator

Awesome!! Happy to see it work on the WebGL Backend thanks to the PBO fallback! 😎

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.

4 participants