kms-glsl icon indicating copy to clipboard operation
kms-glsl copied to clipboard

Great work

Open ErikOostveen opened this issue 3 years ago • 2 comments

Sorry for using this issues section to comment on the fantastic job you have done putting this together. Good stuff!

I would love to be able to control shaders through an ADC on the raspberry pi. Is there some way to launch a shader file from the cli using python and have python read an ADC (like the mcp3008) and pass this on to a shader so that for example you can use an external knob to control a colour in the shader code? This project has great potential to be turned into a cool module that can act as a backdrop for (electronic) musicians. See my website also: www.erikoostveen.co.uk

ErikOostveen avatar Jun 22 '21 17:06 ErikOostveen

Thanks a lot for the feedback!

I agree it'd be awesome to enable interactivity and provide inputs to the shaders. Originally, I thought about feeding shaders with the mouse uniform, keyboard, and audio / video textures, but the idea to feed them using the Raspberry Pi GPIO is even cooler.

It seems interfacing the ADC would be easier using a C library. It seems WiringPi supports the MCP3008: https://www.raspberrypi.org/forums/viewtopic.php?t=54366. Otherwise, it might be possible to use any GPIO C library to interface the DAC with the SPI bus, and feed a float uniform to the shaders.

astefanutti avatar Jun 23 '21 13:06 astefanutti

I'd love to figure out how that could work. I am not a software engineer and most of my projects are with the Arduino/ESP32 so working now with Raspberry is a bit of a learning curve :-)

With the help of your cool code, we can create an amazing open source video synthesizer (Eurorack) module for artists to use as a visual for when they do their online or on-stage performances you see.

... so, let's say that I want to be able to change, on the fly, any of the variables in the attached .glsl ... let's say the number "200.0" in the line: "float modAmount = mod(float((px))/200.0, 3.0);" how would I go about reading that from a python script? I have a working MCP3008 setup for which I can read 8 analog channels and capture those in variables ... my struggle is now to figure out how can I pass that on to the .glsl ?

test14.zip

ErikOostveen avatar Jun 26 '21 16:06 ErikOostveen

Just wanted to say thanks as well! This project enabled me to finish a Christmas present for a friend.

Also was able to get this to run on a Raspberry Pi 1 B+. Quite a few of the examples are broken, but I think it's less with this library and more with the driver. I ended up having to downgrade a lot of the stuff in my own shader to run it on this platform.

I found on the 1 B+ that in the suggested boot/config parameters, v3d_freq_min=500 would crash the pi for whatever reason.

Cobertos avatar Dec 27 '22 20:12 Cobertos

@Cobertos thanks a lot for the feedback! You're right about issue with the examples. I've added a warning about the minimal OpenGL ES version required in 2c6fadf1483169b9f3ac262b2d44a77d4c196152. I've also removed the suggestion to set v3d_freq_min=500, as it's not required anymore with newest versions of the VC4 V3D driver.

astefanutti avatar Jan 18 '23 17:01 astefanutti

First of all thank you very much for your work! Impressive!

Second just to report it is working in a RPi 2B with the the fake driver (vc4-fkms-v3d) and analog composite video output through the RPi minijack. It is probably silly, but I tried to run it with X server running and it gave the error xcb_randr_create_leas failed then I shutdown X with sudo service lightdm stop and it worked like a charm.

Following the conversation, what about MIDI integration? I know openframeworks has this addon. If you achieve audio reactivity and midi integration I "make you an statue" hehe

Thank you!

k10z avatar Apr 12 '23 11:04 k10z

@k10z thanks a lot for the positive feedback!

User input / interactivity is the next major area I'd like to focus on. I've started thinking about it, and have few ideas. Hopefully I'll be able to work on it soon.

astefanutti avatar Apr 12 '23 12:04 astefanutti

I've finally been able to iterate on this, and developed a Python wrapper around the native library in #21.

I've updated the README, and you'll be able to find some examples on how to bring your own inputs specifically in the glsl.py file:

https://github.com/astefanutti/kms-glsl/blob/f85385532afdddbd0f42e554c94047e8d203f06c/glsl.py#L19-L126

Hopefully this will meet your needs, and I'm eager to see what you guys will built with this 🤩.

astefanutti avatar Dec 22 '23 16:12 astefanutti