Giter Site home page Giter Site logo

pilka's Introduction

pilka ๐Ÿ”ฉ

Crates.io

Pilka is a cross-platform live-coding tool for creating shader* demos, similar to Bonzomatic, KodeLife or sh4der-jockey.

Available features:

  • Hot-reload
  • Saving shaders
  • Taking screenshot
  • Record video
  • Compute pipeline for post processing

preview

How

In current state pilka tries to seek shaders folder with the files shader.vert and shader.frag, on fail pilka will generate default setup for you. Then open shader in your favourite code editor (VS, emacs, vim, ed etc.) and pilka would fetch changes after each save.

Controls

  • F1: Print help
  • F2: Toggle play/pause
  • F3: Pause and step back one frame
  • F4: Pause and step forward one frame
  • F5: Restart playback at frame 0 (Time and Pos = 0)
  • F6: Print parameters
  • F7: Toggle profiler
  • F8: Switch backend
  • F10: Save shaders
  • F11: Take Screenshot
  • F12: Start/Stop record video
  • ESC: Exit the application
  • Arrows: Change Pos

Parameters

(per-draw-update)

name type range
position vec3 (-โˆž, โˆž)
time float [0, โˆž)
resolution vec2 [0, a]
mouse vec2 [-1, 1]
mouse_pressed bool
frame uint
time_delta float
record_period float
prev_frame texture

Flags

  • --record f32 - Specify duration of recorded video
  • --size u32xu32 - Specify window size and lock from resizing
  • --wgsl - Creates template for wgsl shaders

Choosing backend

You can select which backend to start with with the PILKA_BACKEND variable. Currently two backends are available: "wgpu" and "ash". If the value of the variable is incorrect, the default backend "wgpu" will be rolled back.

Requirements

Vulkan SDK is required.

On recent macOS, to allow sound input to be captured (for FFT textures to be generated), you need to: Open up System Preferences, click on Security & Privacy, click on the Privacy tab then click on the Microphone menu item. Make sure pilka is in the list and ticked... erm, probably. I don't have macOS.

Installation

cargo install pilka

You also can install the application by to downloading the source code and build locally.

# or through ssh [email protected]:pudnax/pilka.git
git clone https://github.com/pudnax/pilka.git
cd pilka
cargo install --path .

Dependencies

winit is the "default" window library in Rust ecosystem. And it covers the most of cross-platform issues for you.

png is used to encode screenshots into png files.

notify is a file watcher and maintains the hot-reload.

naga is used to compile GLSL shaders on the runtime.

ash is a Vulkan bindings. I choose ash because I see pilka as a learning project and want to touch the maximum untouched Vulkan. For the same reason I didn't use vulkano, erupt, vulkanism, vkvk.

wgpu is save GPU abstraction over different graphics API like Vulkan, Metal, OpenGL and used for primary backend aside of ash.

puffin is scoped profiler written in Rust by EmbarkStudios and I baked it to pilka for fast performance checking.

pollster is smol blocking executor and needed for eliminating async wgpu API.

Ffmpeg is used to record videos. For my concerns it's temporary solution after which I switch to rav1e on it's release.

Places of inspiration (from where I steal code):

Examples

You can run any example by executing pilka inside of the folder

cd examples/cube
cargo run
cube cellular automata line segment
cube automata line
dithering circle pattern menger sponge
dithering pattern spoonge
path tracer lasers oblique slices
tracer lasers slices

pilka's People

Contributors

dependabot[bot] avatar iamtakingithard avatar krzentner avatar pudnax avatar zicklag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pilka's Issues

Improved CLI

Would you be open to pull requests adding an improved CLI using the clap crate?

I've been looking around for a similar tool and this one looks pretty nice so far. :D

Cargo install pilka fails on Windows 10

Compiling pilka_ash v0.7.4
error[E0308]: mismatched types
--> C:\Users\Mike Lee.cargo\registry\src\github.com-1ecc6299db9ec823\pilka_ash-0.7.4\src\pvk\instance.rs:144:49
|
144 | unsafe { ash_window::create_surface(&self.entry, &self.instance, window, None) }?;
| ^^^^^^^^^^^ expected struct ash::entry::Entry, found struct ash::Entry
|
= note: expected reference &ash::entry::Entry
found reference &ash::Entry
= note: perhaps two different versions of crate ash are being used?

error[E0308]: mismatched types
--> C:\Users\Mike Lee.cargo\registry\src\github.com-1ecc6299db9ec823\pilka_ash-0.7.4\src\pvk\instance.rs:144:62
|
144 | unsafe { ash_window::create_surface(&self.entry, &self.instance, window, None) }?;
| ^^^^^^^^^^^^^^ expected struct ash::instance::Instance, found struct ash::Instance
|
= note: expected reference &ash::instance::Instance
found reference &ash::Instance
= note: perhaps two different versions of crate ash are being used?

error[E0277]: ? couldn't convert the error to ash::vk::Result
--> C:\Users\Mike Lee.cargo\registry\src\github.com-1ecc6299db9ec823\pilka_ash-0.7.4\src\pvk\instance.rs:144:93
|
144 | unsafe { ash_window::create_surface(&self.entry, &self.instance, window, None) }?;
| ^ the trait From<ash::vk::enums::Result> is not implemented for ash::vk::Result
|
= note: the question mark operation (?) implicitly performs a conversion on the error value using the From trait
= note: required because of the requirements on the impl of FromResidual<std::result::Result<Infallible, ash::vk::enums::Result>> for std::result::Result<surface::VkSurface, ash::vk::Result>

error[E0308]: mismatched types
--> C:\Users\Mike Lee.cargo\registry\src\github.com-1ecc6299db9ec823\pilka_ash-0.7.4\src\pvk\instance.rs:148:13
|
148 | surface,
| ^^^^^^^ expected struct SurfaceKHR, found struct ash::vk::definitions::SurfaceKHR
|
= note: perhaps two different versions of crate ash are being used?

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try rustc --explain E0277.
error: could not compile pilka_ash due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile pilka v0.7.6, intermediate artifacts can be found at C:\Users\MIKELE~1\AppData\Local\Temp\cargo-installxleCNo

Caused by:
build failed

wgpu: Add internal threadpool

Reading from the device buffer in wgpu is an async task. And for decent video recording I'm thinking of adding thread pool and pushing tasks in it for resolving.
But I'm losing ordering this way. First idea that come to my mind is attaching frame number to the task and when it's ready I send it to the another thread with channel.
On the other end receiving bytes+frame number to BinaryHeap restoring the right ordering.

`cargo install pilka` fails

   Compiling pilka_ash v0.7.0
error[E0412]: cannot find type `Entry` in crate `ash_molten`
  --> /Users/nikita/.cargo/registry/src/github.com-1ecc6299db9ec823/pilka_ash-0.7.0/src/pvk/instance.rs:34:28
   |
34 |     pub entry: ash_molten::Entry,
   |                            ^^^^^ not found in `ash_molten`
   |
help: consider importing one of these items
   |
1  | use ash::Entry;
   |
1  | use crate::Entry;
   |
1  | use std::collections::btree_map::Entry;
   |
1  | use std::collections::hash_map::Entry;
   |

error[E0277]: the `?` operator can only be applied to values that implement `Try`
  --> /Users/nikita/.cargo/registry/src/github.com-1ecc6299db9ec823/pilka_ash-0.7.0/src/pvk/instance.rs:49:21
   |
49 |         let entry = ash_molten::MoltenEntry::load()?;
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the `?` operator cannot be applied to type `MoltenEntry`
   |
   = help: the trait `Try` is not implemented for `MoltenEntry`

Some errors have detailed explanations: E0277, E0412.
For more information about an error, try `rustc --explain E0277`.
error: failed to compile `pilka v0.7.3`, intermediate artifacts can be found at `/var/folders/1k/09s_wjt1151d9z8pd73qjjdm0000gn/T/cargo-installRXqBl3`

Caused by:
  could not compile `pilka_ash` due to 2 previous errors

Nvim integration

Connect to nvim or open nvim as subprocess and communicate on stdin and stdout using the msgpack-rpc format.

cargo install fails on Mac OS X due to #![feature] flag

Building on Mac OS X fails with the following error:

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/pilka_wgpu-0.7.4/src/lib.rs:2:1
  |
2 | #![feature(array_methods)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0554`.
error: could not compile `pilka_wgpu` due to previous error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.