-
Notifications
You must be signed in to change notification settings - Fork 77
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
Shader defined effects using naga oil virtual functions #363
Comments
Thanks @ncthbrt for opening that issue, and for the reference of that GDC talk it's fantastic, I had missed it! This feels so energizing to see all the possible things Housemarque can build with particles. On the actual feature request now, let me elaborate a bit on the vision for Hanabi and how this fits. If you check the Expression API implementation you'll note that it's under a
As a consequence, for now most VFX are authored via code. I say "most" because I know about at least 1 user created editor that I tried, and it's amazing, but was never released publicly, but at least confirmed my instinct that this was the right path. But authoring by code is not ideal by any measure; this is only a stop gap. I believe once those limitations overcome, the visual editing is the path forward for 99% of the users. That being said, I appreciate that, in part because Hanabi's modifiers and expressions are not user-extensible (and I'm not sure how much they could be, it's reasonably complex), having an escape hatch down to raw shader code is necessary. So your suggestions 100% fits in that vision I think. I'm not sure exactly what |
Thanks for the detailed reply! To expand on virtual functions, here is a snippet copied from the documentation:
virtual fn point_light(world_position: vec3<f32>) -> vec3<f32> { ... }
#import bevy_pbr::lighting as Lighting
override fn Lighting::point_light (world_position: vec3<f32>) -> vec3<f32> {
let original = Lighting::point_light(world_position);
let quantized = vec3<u32>(original * 3.0);
return vec3<f32>(quantized) / 3.0;
}
My thinking here was that generated/manual code could be in a separate module and override the particular function (such as lifetime, update, or init) |
Also we had a good discussion in rendering on the bevy discord about how it might be possible to introspect on wgsl structs to allow for reflection in rust land which could be good for tweaking effect settings without having to drop into rust code. |
Describe the solution you'd like
As the title describes, naga oil has functionality to declare virtual functions. It'd be fantastic if this could be leveraged to be able to write custom age, init, update functions, etc instead of using the expression builder. This experience would be much like writing vertex/fragment shaders but on a per particle basis.
Describe why you want that solution. Is this related to a problem?
Hanabi's effect expression builder can be quite complicated and in some cases, a particle effect could be authored more efficiently using plain wgsl. It would still be possible to support both experiences by using virtual functions in the shader builder.
Describe alternatives you've considered
Using the hanabi expression api as it currently exists
Additional context
Add any other context or screenshots about the feature request here.
This is a great talk about an extremely flexible and powerful particle system that takes this approach
https://youtu.be/qbkb8ap7vts?si=KIMa32aVuG80uxPr
The text was updated successfully, but these errors were encountered: