alphastrata / shadplay

Real-time wgsl visualisation tooling for educating oneself in the art of shader programming
MIT License
357 stars 10 forks source link

[FEAT] a couple of ideas #76

Open exo-cortex opened 10 months ago

exo-cortex commented 10 months ago
  1. It would be nice to easily run existing shaders or save new ones in a user-defined directory. I could imagine having a special folder on my computer with shaders that I share with others (with syncthing for example or via git).

some context: Years ago I made visuals with the Winamp-plugin "AVS" (Advanced Visualization Studio). AVS was basically a list of effects that would be applied sequentially (but all on the CPU). Which effects could be defined by the user. Each effect would take the framebuffer and modify it in some way. Some of these effects were itself programmable and could be used to write code. The small community of AVS-artists would make compilations of these "presets" and release them - like albums. It would be nice to make something similar with shadplay as well - have the users define a folder on their computer where they can navigate, write and play shaders in.

  1. Similar to the winamp-plugin it would be nice if shadplay could provide an audio-spectrum and audio wave-form. (Both L/R). Bonzomatic (what shadplay is inspired a little I guess) has a spectrum and a smoothed spectrum as a 1D-texture uniform, that would also be nice here. (no waveform though!)

  2. When using the window without decorations it would be nice if it could be dragged easily dragged with the mouse (like mpv). Maybe if interaction is possible in the shader this could be toggled through a command?

  3. change the key for the help-overlay from ? (on my computer it's "/" btw) to F1 of "H" maybe. Also make the overlay bigger - maybe it could be displayed in terms of uv-coordintaes (from 0 to 1). It should always fill the same amount of screen.

  4. It would be nice if there was a way of creating a "base" shader. Like a template. (I'm not yet sure how that would work, but maybe from shadplay a default-shader-template.wgsl could be placed in the current directory.

  5. A GUI where I could navigate the folder structure (ideally with WASD or arrow-keys. Maybe navigation could work similar to the TUI-filemanager "ranger"? This GUI could be a shader itself maybe ? I am a fan of quick and efficient GUIs that can be used completely with a keyboard. An example: in the current directory up/down would go through the list of folders or shaders, right would either enter the folder (if it is one) or if it is a shader there would be several options available like "run", "view code", "view tags"(see #7.) or maybe "share with yet to be established shadplay-community" :-) or something.

  6. A defined way of adding "author", "name", "based-on/original-by" and other tags to a shader. In AVS we had an effect "comment" that would do nothing, but could be used to add some context. Like "this is 03 of the preset-pack called lalala" and also some nice ASCII-art :D. You the (main dev) could set a certain way of defining these tags - like mard-down frontmatter maybe. Authorship would be very nice (not because of copyright - that could be voided maybe by you globally?) because in AVS a lot of presets would be remixes or remixes-of-remixes-of-etc of other presets. (If you are interested in AVS a close friend of mine is in the process of porting this ancient complicated program to linux/cross platform. In the far future a lot of the original effect might be adapted as actual shaders as well. the repo is here: https://github.com/grandchild/vis_avs There are a few people left of the avs-community. here is a channel: https://discord.com/channels/434058775012311061/843863800029773835 (I will write a post there about shadplay after this here).

alphastrata commented 10 months ago

Heyo,

Huge wall of text there, I'm very appreciative of the time you took to write it up.

So, (1) would be difficult because we can't really have the asset server watching multiple directories for changes to the shadercode (i.e currently it watches ./assets/**/*) -- I can see some immediate hackky solutions to this buy just copying over the user's defined path(s), but there would be a (imo) pretty fundamentally difficult issue there in that, the tool is made with Bevy, which as a game engine, by design assumes you (the game programmer) has told Bevy where your assets are, and what they'll be.

(2) I would like to put audio in at some stage, I'll go ahead and make an [FEAT] Issue for that because, shadertoy has that and so should we!, despite that I'm not super-duper how useful/commensurate it is with the project's goals.

(3) Out of scope, window location/drag-ability is the domain of the OS, or a user's WM. Linux users will already likely have this functionality with super+left mouse drag or similar, I think that's the default Gnome binding.

(4) This could be ok, I guess the bindings are a very 'personal' thing RE what folk are used to, F1 for help is very windows-centric/GUI-everthing user-centric, but as there's already a config that stores the last known dimensions of the window and whether or not the decorations were on there'd be no harm in whipping up a keybindings configuration system, which would likely get swallowed by this.

(5) Not super sure what we're missing that doesn't already tick this box? The default 2d/3d shaders have a few of the (imo) essential imports and load a clone of the default shader that shadertoy would give you...

(6) out of scope, a good file manager is a whole project in and of itself.

(7) I'm really into this, especially as long term I'd like the community's contributions to the assets/Gallery to full of shaders I didn't write, ideally accompanied by detailed explanations of their inner workings etc so others can learn from the tricks of their (the shaders') authour. The shaders versioning stuff (what happens when you hit space) needs to be far more sophisticated, whilst I'm not sure more GUI is the answer, there is definitely more to be done there.