Code Monkey home page Code Monkey logo

veda's Introduction

logo

VEDA

VJ / Live Coding on Atom with GLSL.


screenshot

TravisCI apm version license MIT code style: prettier Greenkeeper badge



TOC

What's this?

VEDA is a GLSL runtime environment for Atom. When you write GLSL code in Atom, VEDA immediately evaluates it and shows the result on the background. It's just like GLSL sandbox or Shadertoy, but you can use autocomplete and linter by using existing Atom packages. Moreover, It supports Audio inputs , MIDI inputs, loading videos and images, etc...!!!!

VEDA has following features.

  • Fragment shaders runtime like GLSL Sandbox
  • Vertex shader runtime like vertexshaderart.com
  • Loading images / videos
  • Additional uniform variables useful for live coding
    • Audio input
    • MIDI input
    • OSC input
    • Webcam input
    • Keyboard input
    • Gamepad input
  • Auto completion (thx to autocomplete-glsl)
  • Linting (thx to linter-glsl)

Tutorial

Install

Just install from Atom GUI or apm.

$ apm install veda

Sometimes Atom shows an error like below. If you see this, please try rebuilding the package from 🐞 icon on the footer.

Failed to require the main module of 'veda' because it requires an incompatible native module.
Run `apm rebuild` in the package directory to resolve.

Features

Commands

VEDA installs following commands to Atom.

  • toggle
    • Start / Stop VEDA.
  • load-shader (key: ctrl-enter)
    • Load the shader on current editor.
  • watch-shader (key: ctrl-shift-enter)
    • Watch current tab and load the shader automatically.
  • watch-active-editor (key: ctrl-alt-enter)
    • Watch active tab and run watch-shader automatically.
  • stop-watching (key: ctrl-.)
    • Stop watch-shader and watch-active-editor.
  • toggle-fullscreen (key: ctrl-escape)
    • Show the output fullscreen in the window

A typical workflow can be like this:

  1. Enable VEDA by running veda:toggle from the Command Palette of Atom.
  2. Edit your GLSL code.
  3. Hit ctrl-enter to run veda:load-shader.

Preset uniform variables

  • float time:
    • The elapsed time since VEDA has started.
  • vec2 resolution
    • The resolution of the screen.
  • vec2 mouse
    • Current position of mouse.
    • vec2(0) to vec2(1)
  • sampler2D backbuffer
    • Rendered result of last frame.
    • RGBA format
  • sampler2D samples
    • Samples of the audio input.
  • sampler2D spectrum
    • FFT result of the audio input.
  • float volume
    • The volume of the audio input.
  • sampler2D midi
    • Last MIDI event for each channel of MIDI devices.
    • x: 3rd byte of the event
  • sampler2D note
    • States of note numbers of MIDI devices.
    • x: the volume of the note

Settings

The settings of VEDA can be configured in 3 ways: global settings, project settings, and file settings.

  • Global settings are loaded from Settings page of Atom.
  • Project settings are loaded from .vedarc.
  • File settings are loaded from the comments of the shader.

The order of priority is as follows:

File Settings > Project Settings > Global Settings

When File Settings and Global Settings has same properties, File Settings are used.

Global Settings

Global settings are most general settings. You can change settings in Settings page of Atom.

If there are no project .vedarc or valid comments, VEDA will use the global settings as default.

Project Settings: .vedarc

Project settings is loaded from .vedarc on your project root.

  • .vedarc must be located in your project's root directory.
  • .vedarc is parsed as JSON5 format.
    • You can write comments in .vedarc.
  • .vedarc is loaded on startup and reloaded automatically when you edit it.

For example, when you write .vedarc like this:

{
  "IMPORTED": {
    "image1": {
      "PATH": "./1.jpg",
    },
  },
  "vertexMode": "LINES",
  "pixelRatio": 2,
  "audio": true,
  "midi": true,
}

Then VEDA interpret like this:

  • Load ./1.jpg as a texture image1
  • Draw lines on vertex shaders
  • Enable audio input
  • Enable MIDI input

File Settings

You can also write settings specific for the file. Write comments on the head of the file like this:

/*{ "audio": true }*/

void main() {
    ...
}

The comment must be written in the same format as .vedarc.

Examples

Fragment Shaders

You can write fragment shaders like GLSL Sandbox.

Fragment shaders must be named like *.frag. Create a file foo.frag like this:

precision mediump float;
uniform float time;
uniform vec2 resolution;

void main() {
    vec2 uv = gl_FragCoord.xy / resolution.xy;
    gl_FragColor = vec4(uv, 0.5 + 0.5 * sin(time), 1.0);
}

Then save it and hit ctrl-enter to run it. VEDA will show the result on the background.

See examples for actual usage.

Vertex Shaders

VEDA also supports vertex shaders like vertexshaderart.com.

Vertex shaders must be named like *.vert. Create a file foo.vert like this:

/*{ "vertexCount": 300 }*/
precision mediump float;
attribute float vertexId;
uniform float vertexCount;
uniform float time;
uniform vec2 resolution;
varying vec4 v_color;

void main() {
  float i = vertexId + time *2.;

  vec3 pos = vec3(
    cos(i * 1.0),
    sin(i * 1.1),
    cos(i * 1.2)
  );

  gl_Position = vec4(pos.x, pos.y, pos.z, 1);

  v_color = vec4(fract(vertexId / 3.), 1, 1, 1);
}

Then save it and hit ctrl-enter to run it. VEDA will show the result on the background.

See examples for actual usage.

Optional Inputs

To use these features, you have to enable them by adding following lines to .vedarc or header comments.

  • Audio inputs: "audio": true
  • MIDI inputs: "midi": true
  • Webcam inputs: "camera": true
  • Keyboard inputs: "keyboard": true
  • Gamepad inputs: "gamepad": true

Audio inputs

You can use audio data of the audio input. These data are obtained by AnalyserNode of Web Audio API.

sampler2D samples stores the most recent 256 frames from the audio input. This is useful for drawing waveforms.

sampler2D spectrum stores the FFT result. This is useful to draw the volume of specific frequency band, such as spectrum visualizer.

float volume is the average of all the frequency bands in spectrum. See examples for actual usage.

MIDI Events

sampler2D midi stores MIDI events obtained by Web MIDI API. The size of midi is 256x128. Each pixel stores the last event of the corresponding MIDI Events.

For example, texture2D(midi, vec2(144. / 256., 0)).x yields the note number of last note on event of MIDI Channel 1.

  • 144. (0x90): note on event of MIDI Channel 1
  • .x (2nd byte): Note number

See examples for actual usage.

sampler2D note stores the volumes for each note number The size of midi is 128x1. Each pixel stores the volume of the last event for corresponding MIDI note.

For example, texture2D(note, vec2(60. / 128., 0)).x yields the volume of note C4 (Middle C).

See examples for actual usage.

OSC Inputs

VEDA accepts OSC messages on the port written in osc property of the settings. When you write "osc": 4000 to .vedarc or the header comment, messages will be stored and passed as textures:

  • Texture name will be automatically generated from addresses.
    • /foo: sampler2D osc_foo
    • /foo/bar: sampler2D osc_foo_bar
  • Arguments are translated to float. Strings are ignored.
    • /foo 0.1 hello 100 yields a texture that contains [0.1 0 100]

See examples for actual usage.

Webcam Inputs

sampler2D camera stores the images from the webcam. texture2D(camera, uv) returns vec3 color.

See examples for actual usage.

Keyboard Inputs

sampler2D key stores the status of keyboard. The size of keyboard is 256x1.

For example, texture2D(key, vec2(65. / 256., 0.)) returns 1.0 when a is pressed.

Hitting ESC key resets the states of all key inputs.

See examples for actual usage.

Gamepad Inputs

sampler2D gamepad stores the status of gamepads connected to the PC. The size of gamepad is 128x2. The status of buttons and axes are stored in y = 0.0 and y = 1.0.

For example, texture2D(gamepad, vec2(3. / 128., 0.)) returns 1.0 when the 3rd button is pressed.

See examples for actual usage.

Loading images / videos

You can load images and videos by adding IMPORTED property in .vedarc or header comments. If you write the path or URL of the resourece, it will be loaded automatically:

/*
{
  "IMPORTED": {
    "image1": {
      "PATH": "1.jpg",
    },
    "image2": {
      "PATH": "../2.png",
    },
    "video1": {
      "PATH": "/Users/foo/Movies/1.mp4",
    },
    "video2": {
      "PATH": "http://example.com/2.mp4",
      "SPEED": 2,  // played 2x faster
    },
  },
}
*/
precision mediump float;
uniform vec2 resolution;

uniform sampler2D image1;
uniform sampler2D image2;
uniform sampler2D video1;
uniform sampler2D video2;

void main() {
	vec2 uv = gl_FragCoord.xy / resolution;

	gl_FragColor = (
		texture2D(image1, uv) +
		texture2D(image2, uv) +
		texture2D(video1, uv) +
    texture2D(video2, uv)
  );
}

The structure of IMPORTED properties is based on Interactive Shader Format.

See these examples for actual usage.

Multipass Rendering

VEDA supports multipass rendering. You can define passes in PASSES property in .vedarc or header comments.

/*
{
  "PASSES": [
    { "TARGET": "buffer" },
    {},
  ],
}
*/

The structure of PASSES property is based on Interactive Shader Format. However, VEDA doesn't support PERSISTENT property.

VEDA supports WIDTH and HEIGHT in PASSES. You can specify numbers for pixels or write expressions using $WIDTH and $HEIGHT.

/*
{
  "PASSES": [
    {
      "TARGET": "buffer",
      "WIDTH": 512,  // 512px
      "HEIGHT": "$HEIGHT / 2",  // half of the render target (= Atom's width / pixelRatio)
    },
    {},
  ],
}
*/

See these examples for actual usage.

Combining VS and FS

In PASSES you can specify vertex shader path from fragment shader, and vice versa. For example, when you write header comments like below in fragment shader, VEDA will use ./vertex.vert for vertex shader instead of default vertex shader.

/*
{
  "PASSES": [{
    "vs": "./vertex.vert",
  }],
}
*/

See these examples for actual usage.

Compute shader

You can write compute shaders using multipass rendering. For compute shaders, we need to specify use float textures like this:

/*{
  "PASSES": [
    {
      "fs": "./velocity.frag",
      "TARGET": "velocityTexture",
      "FLOAT": true,
    },
    {
      "fs": "./position.frag",
      "TARGET": "positionTexture",
      "FLOAT": true,
    },
    {
      "vs": "./scene.vert",
      "fs": "./scene.frag",
      "TARGET": "sceneTexture",
    },
    {}
  ]
}*/

To initialize textures, use uniform int FRAMEINDEX.

uniform int FRAMEINDEX;

void main(){
    if (FRAMEINDEX == 0) {
        gl_FragColor = vec4(0);
    }
    else {
        // Do what you want
    }
}

See an example for actual usage.

Loading 3D models

You can load 3D models by passing file path to MODEL property in PASSES:

/*{
  "PASSES": [{
    "vs": "./foo.vert",
    "MODEL": { "PATH": "./foo.obj" },
  }]
}*/

When you load .obj files in fragment shader, your shader is applied on the model defined in .obj file. When you load .obj in vertex shader, you can use following attributes:

  • attribute vec3 position
  • attribute vec3 normal

Then

precision mediump float;
attribute vec3 position;
attribute vec3 normal;
varying vec4 v_color;

void main(){
    gl_Position = vec4(position, 1);
    v_color = vec4(dot(normal, vec3(1)); // Lighting
}

If you use .obj files, you can also load .mtl files for materials:

/*{
    PASSES: [{
        MODEL: {
            PATH: `foo.obj`,
            MATERIAL: `foo.mtl`,
        }
    }]
}*/

Materials are loaded as textures like uniform sampler2D material0, uniform sampler2D material1, etc.

See examples for more detail.

glslify

VEDA supports glslify.

If "glslify": true is in the settings, VEDA bundles the code with glslify before evaluating. Note that it will cause lint errors because linter-glsl doesn't support glslify.

See examples for actual usage.

Server Mode

If you wanna hide code and show only the shaders, you can use server mode. When server is specified, VEDA launches a web server instead of running shaders in the background of Atom.

In this example, VEDA runs server on http://localhost:3000. You can run shaders on the browsers by opening the url.

/*
{
  "server": 3000,
}
*/

Warning: Currently we can't use videos/images outside the project directory in server mode.

See an example for actual usage.

Sound shader (experimental)

VEDA supports sound shaders like Shadertoy.

There are 2 command for sound shaders:

  • Veda: Load Sound Shader (alt-enter): Play current shader as a sound shader.
  • Veda: Stop Sound Shader (alt-.): Stop sound shaders.

In sound shader you have to define vec2 mainSound(float time) function instead of void main(). mainSound takes current time stamp (time) and return the sample for stereo channels (vec2).

For example, this shader plays 440Hz and 660Hz sine wave in left and right channel.

#define PI 3.141592653
vec2 mainSound(in float time) {
  return vec2(
    sin(2. * PI * time * 440.),
    sin(2. * PI * time * 660.)
  );
}

See an example for actual usage.

Contributing

Any kind of issues or PRs are welcome!!😸

Before sending PRs, make sure you installed npm packages with yarn, not npm. If not, we can't merge the PRs because this might cause errors and unnecessary diffs.

Contributors

Thanks goes to these wonderful people (emoji key):


Takayosi Amagi

💬 💻 🎨 📖

Jonathan Giroux (Koltes)

🐛 💻 👀

Cezary Kopias

🐛 💡

tanitta

💻 🤔

Yuya Fujiwara

🐛

Rikuo Hasegawa

🐛 💻 💡

This project follows the all-contributors specification. Contributions of any kind welcome!

Author

Takayosi Amagi

License

MIT

veda's People

Contributors

asonas avatar fand avatar greenkeeper[bot] avatar greenkeeperio-bot avatar kame7c0 avatar koltesdigital avatar mtmckenna avatar renovate-bot avatar renovate[bot] avatar sp4ghet avatar tanitta 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

veda's Issues

vertex shader black screen

tested on: Atom 1.20; glsl-livecoder 0.9.4 and 0.10.0; linux and windows
I tried to code some vertex shader and got only black (also tried with example).

0.8.1 works 😄

Clarification for Installation instructions on website for glslangValidator on windows

on the website instructions to install for windows, ti says to put in the directory to glslangValidator, in the settings, I ended up having to put the filename also. I suggest changing this:
After that, add installed glslangValidator to your PATH environment variable.
In Windows, glslangValidator will be installed in C:\VulkanSDK( version )\Bin.
The path of glslangValidator can also be specified in the settings of VEDA
C:\VulkanSDK( version )\Bin\glslangValidator.exe<< add right here

server not working. dyld: Library not loaded

trying to turn on a server with "server": 1234 is giving dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.59.dylib Referenced from: /usr/local/bin/node Reason: image not found

Uncaught TypeError: Cannot read property 'getPath' of undefined

This error gets thrown when you attempt to close out all tabs while in "watch active shader" mode and go to the blank window screen.

TypeError: Cannot read property 'getPath' of undefined
    at GlslLivecoder.loadShaderOfEditor (file:///C:/Users/rikuo/.atom/packages/glsl-livecoder/lib/glsl-livecoder.js:178:24)
    at GlslLivecoder.watchShader (file:///C:/Users/rikuo/.atom/packages/glsl-livecoder/lib/glsl-livecoder.js:137:10)
    at file:///C:/Users/rikuo/.atom/packages/glsl-livecoder/lib/glsl-livecoder.js:125:12
    at Function.module.exports.Emitter.simpleDispatch (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\node_modules\event-kit\lib\emitter.js:25:20)
    at Emitter.module.exports.Emitter.emit (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\node_modules\event-kit\lib\emitter.js:141:34)
    at Workspace.didChangeActivePaneItemOnPaneContainer (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\src\workspace.js:502:30)
    at WorkspaceCenter.paneContainer.onDidChangeActivePaneItem (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\src\workspace-center.js:17:20)
    at Function.module.exports.Emitter.simpleDispatch (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\node_modules\event-kit\lib\emitter.js:25:20)
    at Emitter.module.exports.Emitter.emit (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\node_modules\event-kit\lib\emitter.js:141:34)
    at PaneContainer.didChangeActiveItemOnPane (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\src\pane-container.js:284:26)
    at Pane.module.exports.Pane.setActiveItem (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\src\pane.js:339:22)
    at Pane.module.exports.Pane.removeItem (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\src\pane.js:626:22)
    at Pane.module.exports.Pane.destroyItem (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\src\pane.js:706:22)
    at Pane.module.exports.Pane.destroyActiveItem (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\src\pane.js:683:18)
    at Workspace.closeActivePaneItemOrEmptyPaneOrWindow (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\src\workspace.js:1703:48)
    at HTMLElement.core:close (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\src\register-default-commands.js:233:38)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\src\command-registry.js:265:35)
    at C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\src\command-registry.js:3:65
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\node_modules\atom-keymap\lib\keymap-manager.js:610:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\node_modules\atom-keymap\lib\keymap-manager.js:401:28)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\src\window-event-handler.js:100:42)
    at HTMLDocument.<anonymous> (C:\Users\rikuo\AppData\Local\atom\app-1.19.5\resources\app\src\window-event-handler.js:3:65)

Hearing audio feedback whenever glsl-livecoder is toggled on

When I load up Atom I experience no audio feedback. As soon as I click Packages->glsl_livecoder->Toggle, I hear audio feedback (echoing and a shrill whine) from the speaker to the microphone. I understand that the audio input API must read the microphone input, but surely it does not need to output the same audio to the speaker.

Using glsl-livecoder 0.4.1 on OSX with Atom 1.18.0 64 bit.

Can't install Veda atom package

npm ERR! tar.unpack unzip error /private/var/folders/7m/9j6vw_vs259cdq2ly2t_lrmw0000gn/T/d-118426-6956-x92wmw.2qt7mvlsor/package.tgz
npm ERR! addLocal Could not install /private/var/folders/7m/9j6vw_vs259cdq2ly2t_lrmw0000gn/T/d-118426-6956-x92wmw.2qt7mvlsor/package.tgz
npm ERR! Darwin 16.7.0
npm ERR! argv "/Users/leotreasure/ApplicationsH/Atom.app/Contents/Resources/app/apm/bin/node" "/Users/leotreasure/ApplicationsH/Atom.app/Contents/Resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/Users/leotreasure/.atom/.apm/.apmrc" "--userconfig" "/Users/leotreasure/.atom/.apmrc" "install" "/private/var/folders/7m/9j6vw_vs259cdq2ly2t_lrmw0000gn/T/d-118426-6956-x92wmw.2qt7mvlsor/package.tgz" "--runtime=electron" "--target=1.7.15" "--arch=x64" "--global-style"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! code Z_DATA_ERROR
npm ERR! errno -3

npm ERR! incorrect data check
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm ERR! tar.unpack untar error /private/var/folders/7m/9j6vw_vs259cdq2ly2t_lrmw0000gn/T/d-118426-6956-x92wmw.2qt7mvlsor/package.tgz

npm ERR! Please include the following file with any support request:
npm ERR!     /private/var/folders/7m/9j6vw_vs259cdq2ly2t_lrmw0000gn/T/apm-install-dir-118426-6956-r8y3b5.n8y5sif6r/npm-debug.log

Use RawShaderMaterial?

Currently VEDA uses THREE.ShaderMaterial but this might cause problems.
e.g. Duplicate declaration of uniforms

audio input linux

system: Ubuntu 17.04 using ALSA

I cant get example 'audio.frag' to work...
I imagine it suppose to use Input Device witch is set to monitoring, so I can use what I hear.
audio_setup

tested with VSXu and it works fine, (I can see audio) - vsxu.com
...so any tips how to get audio would be great.

P.S. Just found this nice package by accident and its a lot of fun. THX.

Keyboard input explination

I tried the keyboard input example but there is no information as to how to get the keys to affect the shader rather than add a letter to the running shader at the cursor.
I suggest adding a blurb to the help / and a comment in the example
found this on the website https://veda.gl/features/keyboard/ which works great (z key not showing on osx chrome). the example does have the keyboard setting comment header. if this is not possible in the atom editor that would be worth noting in the relevant help/package readme

Uncaught TypeError: Cannot read property 'then' of undefined

[Enter steps to reproduce:]

  1. Open Atom >> ctrl+shift+p >> glsl livecoder toggle; to enable
  2. ctrl+shift+p >> glsl livecoder toggle; to disable (and get this error)... you cant enable it again

Atom: 1.20.0 x64 also tested in 1.19.6 x64
Electron: 1.6.9
OS: Ubuntu 17.04
Thrown From: glsl-livecoder package 0.9.2

Stack Trace

Uncaught TypeError: Cannot read property 'then' of undefined

At /home/ck/.atom/packages/glsl-livecoder/lib/camera-loader.js:40

TypeError: Cannot read property 'then' of undefined
    at CameraLoader.disable (/packages/glsl-livecoder/lib/camera-loader.js:40:19)
    at ThreeShader.stop (/packages/glsl-livecoder/lib/three-shader.js:246:24)
    at GlslLivecoder.stop (/packages/glsl-livecoder/lib/glsl-livecoder.js:141:17)
    at GlslLivecoder.toggle (/packages/glsl-livecoder/lib/glsl-livecoder.js:127:14)
    at HTMLElement.glslLivecoderToggle (/packages/glsl-livecoder/lib/index.js:95:47)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app/src/command-registry.js:265:35)
    at /usr/share/atom/resources/app/src/command-registry.js:3:65
    at Object.didConfirmSelection (/usr/share/atom/resources/app/node_modules/command-palette/lib/command-palette-view.js:106:35)
    at SelectListView.confirmSelection (/usr/share/atom/resources/app/node_modules/atom-select-list/src/select-list-view.js:313:26)
    at HTMLDivElement.core:confirm (/usr/share/atom/resources/app/node_modules/atom-select-list/src/select-list-view.js:81:20)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app/src/command-registry.js:265:35)
    at /usr/share/atom/resources/app/src/command-registry.js:3:65
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/usr/share/atom/resources/app/src/window-event-handler.js:100:42)
    at HTMLDocument.<anonymous> (/usr/share/atom/resources/app/src/window-event-handler.js:3:65)

Commands

     -0:26.1.0 intentions:highlight (input.hidden-input)
     -0:26 command-palette:toggle (input.hidden-input)
     -0:23.9.0 core:confirm (input.hidden-input)
     -0:23.4.0 glsl-livecoder:toggle (input.hidden-input)
     -0:22.2.0 intentions:highlight (input.hidden-input)
     -0:22 glsl-livecoder:load-shader (input.hidden-input)
     -0:21 intentions:highlight (input.hidden-input)
     -0:19.9.0 command-palette:toggle (input.hidden-input)
     -0:18.7.0 core:confirm (input.hidden-input)
     -0:18.7.0 glsl-livecoder:toggle (input.hidden-input)

Non-Core Packages

atom-rst-preview-docutils 1.0.0 
atom-typescript 11.0.8 
autocomplete-glsl 0.2.3 
autocomplete-python 1.10.2 
busy-signal 1.4.3 
glsl-livecoder 0.9.2 
intentions 1.1.5 
javascript-snippets 1.2.1 
language-glsl 2.0.1 
language-ini 1.19.0 
language-javascript-jsx 0.3.7 
language-kivy 0.2.0 
language-restructuredtext 1.1.0 
linter 2.2.0 
linter-glsl 2.1.3 
linter-ui-default 1.6.8 
MagicPython 1.0.12 
minimap 4.29.6 
minimap-find-and-replace 4.5.2 
open-unsupported-files 1.0.20 
pretty-json 1.6.4 
python-indent 1.1.0 
python-tools 0.6.9 
run-in-terminal 1.0.1 
script 3.15.0 
theme-switcher 1.1.0 
videoplayer 1.2.1 

WebGL2

VEDA is built on Three.js now.
There is an issue for WebGL2Renderer but it seems to be diffucult 😇
mrdoob/three.js#9965

Babylon.js already supports WebGL.
https://www.babylonjs.com/

Should we wait for THREE.WebGL2Renderer, or migrate to Babylon.js...?

Support OSC

OSC is a widely-used protocol like MIDI, but more flexible.
I'm not familiar with OSC. Comments welcome!

Uncaught ReferenceError: regeneratorRuntime is not defined

Uncaught ReferenceError: regeneratorRuntime is not defined
    at bundle.js:10051
    at new Player (bundle.js:10108)
    at Socket.<anonymous> (bundle.js:6732)
    at Socket.Emitter.emit (bundle.js:3502)
    at Socket.onevent (bundle.js:6429)
    at Socket.onpacket (bundle.js:6387)
    at Manager.<anonymous> (bundle.js:6636)
    at Manager.Emitter.emit (bundle.js:3502)
    at Manager.ondecoded (bundle.js:5513)
    at Decoder.<anonymous> (bundle.js:6636)

To reproduce the issue: load any shader from the local server (Veda 2.4.0).

How to add midi notes per channel?

Hi, I was wondering if it is possible to add that feature. I was looking up in the code but I couldn't find where the midi sampler2D are managed.

Amazing work on veda!

Not working here.

Well I tried several installation following your instruction but nothing happen here.
I`m on El Capitan 10.11.6, glslang 3.0 is installed and I try to run glsl-livecoder with Atom 1.20. I have also the linter packages dependency but nothing happens when I open your examples and try to load and watch the shaders wether I toggle glsl-livecoder or not.
Did I miss something?

Can't get midi example working

Running this in Tidal Cycles and I get black screen:

import Sound.Tidal.MIDI.Context
displayOutputDevices >>= putStrLn
devices <- midiDevices
m1 <- midiStream devices "IAC Driver Bus 1" 1 synthController

m1 $ n "cs5 a4"

from web midi monitoring midi events appear to be working:

Found 1 MIDI input(s)
Connected first input: IAC Driver Bus 1
controller id: 61, value: 63
controller id: 61, value: 60
controller id: 57, value: 63
controller id: 57, value: 60

Logo

Concepts

  • Atom
    • Atom logo
    • hex
  • GLSL
    • 2 triangle polygons
    • uv gradients
    • plasma
    • fragments
  • livecooding
    • play button icon
    • file icon
    • keyboard

Video playback speed

It would be nice if we can change the speed of videos like this:

{
  "IMPORTED": {
    "video1": {
      "PATH": "./videos/1.mp4",
      "RATE": 0.5,  // video1 plays 50% slower
    },
    "video2": {
      "PATH": "./videos/2.mp4",
      "RATE": 2,  // video2 plays 200% faster
    }
  }
}

Improve autocomplete-glsl performance

Auto completion causes jank frames...

Here is a profile on jank frames.
The slowest frame took 953ms.
2017-07-25 10 41 47

It seems there are 2 main causes:

  • Rendering elements overlying WebGL canvas is slow
    • we can mitigate the janks by applying some symptomatic treatments:
      • throttling
      • disabling styles on elements overlying WebGL canvas
  • autocomplete-plus is slow
    • There is an issue about improving performance atom/autocomplete-plus#839
    • According to the issue, rewriting renderItem with etch might be effective
    • I tried to rewrite renderItem with etch but putting off cause it seemed to take long time for me

looking for alternative solutions...

Rename .liverc to .vedarc

The name .liverc come from glsl-livecoder, but it's renamed to VEDA.
We should use .vedarc by default and replace the names in README.

convertPathForServer test fails on Windows

  × utils » convertPathForServer
  √ config » createRc returns DEFAULT_RC by default
  √ config » setFileSettings changes Config
  √ config » setProjectSettings changes Config
  √ config » setGlobalSettings changes Config
  √ config » setFileSettings > setProjectSettings > setGlobalSettings
  √ config » setFileSettings returns diffs and newConfig
  √ config » rc and soundRc is isolated
  √ config » setFileSettingsByString works the same as setFileSettings
  √ config » setSoundSettingsByString works the same as setSoundSettings

  1 test failed

  utils » convertPathForServer

  C:\Projects\veda\test\utils.js:8

   7:     t.is(convertPathForServer('/foo/bar', 3000, 'baz'), 'http://localhost:3000/link/baz');
>  8:     t.is(convertPathForServer('/foo/bar', 3000, 'baz/qux'), 'http://localhost:3000/link/baz/qux');
   9:     t.is(convertPathForServer('/foo/bar', 3000, 'baz/././qux/'), 'http://localhost:3000/link/baz/qux');

  Difference:

  - 'http://localhost:3000/link/baz\\qux'
  + 'http://localhost:3000/link/baz/qux'

Uncaught TypeError: Cannot read property 'disconnect' of undefined

When I try to toggle it off, I get this error. And after I want to toggle it on, the same error appears again
Atom: 1.19.2 x64
Electron: 1.6.9
OS: Microsoft Windows 10 Enterprise 2016 LTSB
Thrown From: glsl-livecoder package 0.7.1

Stack Trace

Uncaught TypeError: Cannot read property 'disconnect' of undefined

At C:\Users\dima-pc\.atom\packages\glsl-livecoder\lib\audio-loader.js:62

TypeError: Cannot read property 'disconnect' of undefined
    at AudioLoader.stop (/packages/glsl-livecoder/lib/audio-loader.js:62:18)
    at ThreeShader.stop (/packages/glsl-livecoder/lib/three-shader.js:189:23)
    at GlslLivecoder.stop (/packages/glsl-livecoder/lib/glsl-livecoder.js:104:17)
    at GlslLivecoder.toggle (/packages/glsl-livecoder/lib/glsl-livecoder.js:90:14)
    at HTMLElement.glslLivecoderToggle (/packages/glsl-livecoder/lib/index.js:62:47)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (~/AppData/Local/atom/app-1.19.2/resources/app/src/command-registry.js:265:35)
    at CommandRegistry.handleCommandEvent (~/AppData/Local/atom/app-1.19.2/resources/app/src/command-registry.js:3:65)
    at CommandRegistry.module.exports.CommandRegistry.dispatch (~/AppData/Local/atom/app-1.19.2/resources/app/src/command-registry.js:166:25)
    at AtomEnvironment.module.exports.AtomEnvironment.dispatchContextMenuCommand (~/AppData/Local/atom/app-1.19.2/resources/app/src/atom-environment.js:1344:34)
    at EventEmitter.outerCallback (~/AppData/Local/atom/app-1.19.2/resources/app/src/application-delegate.js:347:31)
    at emitThree (events.js:116:13)
    at EventEmitter.emit (events.js:194:7)

Commands

     -4:43.8.0 intentions:highlight (input.hidden-input)
     -4:43.3.0 glsl-livecoder:watch-shader (input.hidden-input)
     -4:41.3.0 intentions:highlight (input.hidden-input)
     -4:40.9.0 glsl-livecoder:watch-shader (input.hidden-input)
     -4:38.7.0 intentions:highlight (input.hidden-input)
     -4:38 glsl-livecoder:watch-shader (input.hidden-input)
     -4:36 intentions:highlight (input.hidden-input)
  2x -4:35.6.0 glsl-livecoder:watch-shader (input.hidden-input)
     -4:20.6.0 intentions:highlight (input.hidden-input)
  4x -4:20.1.0 glsl-livecoder:watch-shader (input.hidden-input)
     -4:13.1.0 intentions:highlight (input.hidden-input)
  2x -4:12.7.0 glsl-livecoder:watch-shader (input.hidden-input)
     -2:49.3.0 glsl-livecoder:toggle (div.line.cursor-line)
     -2:43.7.0 command-palette:toggle (input.hidden-input)
     -2:40.7.0 core:confirm (input.hidden-input)
     -2:40.7.0 glsl-livecoder:toggle (input.hidden-input)

Non-Core Packages

atom-beautify 0.30.3 
autocomplete-glsl 0.2.3 
busy-signal 1.4.3 
gcc-make-run 0.2.9 
glsl-livecoder 0.7.1 
intentions 1.1.5 
language-glsl 2.0.1 
linter 2.2.0 
linter-gcc 0.7.1 
linter-glsl 2.1.3 
linter-ui-default 1.6.7 

I want to connect withtidalcycles

I want to connect with tidalcycles and veda now.It was already realized in MacOS and win32.(See this link https://youtu.be/kjC2QEZQa_Y)
But this sorce code didn't work well in my computer environment.
My computer environment is win64 ver 10.
If you know the solution,please give me some comment.

MIDI not working on Windows

reported by la_gauche, thx!

Talk log on livecode.slack.com
la_gauche [8:19 AM] 
@U6C6GQYG1 do I need to do anything in particular to get your midi.frag or note.frag example working? I'm sending midi out of tidal using loopMIDI. It's a windows virtual midi router if you aren't familiar. Chrome is picking it up. I've tested a few random synths in webpages. I'm sending out notes, but nothing is happening in my Atom background. Just a black screen. Not sure if I have to install a plugin on top of Veda so that it picks up Web Midi (edited)
1 reply Today at 10:07 AM View thread


amagitakayosi [10:07 AM] 
It doesn't need any plugins. Maybe it's a problem of MIDI status number.
open this page and try MIDI events then show me the logs, plz :pray: https://mikatahara.github.io/SendReceive/


la_gauche [10:07 AM] 
ok ill try now


la_gauche [10:10 AM] 
uploaded and commented on this image: web midi.png
1 Comment
@U6C6GQYG1 I had to change to a different port at the top, but otherwise it's receiving messages. I don't know what CC or notes I should send note.frag or midi.frag if that matters. I'm just sending many different notes with different velocities for my test.



la_gauche [10:21 AM] 
I don't know GLSL obviously : )


amagitakayosi [10:24 AM] 
hm.. it seems nothing's wrong.. virtual MIDI keys on my mac shows almost same logs but note.frag works. Is there any errors when you open Devtools on Atom?


la_gauche [10:25 AM] 
I don't think so, but I haven't used dev tools. Other *.frag examples work great and many from the glsl sandbox website


[10:25] 
I'm on Windows 10 64bit if that matters


amagitakayosi [10:28 AM] 
I said `nothing's wrong` to the screenshot :sweat_smile:


la_gauche [10:30 AM] 
uploaded and commented on this image: dev tools.png
1 Comment
A pic of note.frag and dev tools open



la_gauche [10:31 AM] 
i think dev tools says there is one html error, but I don't think that's related. (edited)


amagitakayosi [10:36 AM] 
ah you're trying tidal-midi! cool


[10:37] 
The MIDI port must be initialized before launching Veda, plz try reloading Atom, init Tidal, make sure the MIDI port is ready, then `veda:toggle`.


[10:38] 
if it doesn't work it must be a bug. I'll open an issue.


new messages
la_gauche [10:47 AM] 
@U6C6GQYG1 oh yes I made sure the midi port is initialized first then I toggle Veda, but no luck. Maybe it is a bug indeed. It could be a Windows bug also : ( I've seen Tidal-Midi + Veda working on a mac

VEDA v3

TODO

  • Sound Shader
  • Refactor Configs
  • [ ] Rewrite vedajs in pure WebGL
  • Support model files like .obj

glsl-livecoder.js:148 Error: Command failed: glslangValidator.exe

イケイケなプラグインありがとうございます!!

I'm having trouble running the plugin on Windows.
image

I've added glsllangValidator.exe to the PATH environment variable and it seems to be ok with finding the binary. I'm not sure where the problem might be, so if you have any ideas it would be much appreciated.

Here are my packages:

Community Packages (36) C:\Users\rikuo\.atom\packages
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Here is the shader file

precision highp float;
uniform vec2 resolution;
uniform float time;

float lengthN(vec3 v, float p)
{
  vec3 tmp = pow(abs(v), vec3(p));
  return pow(tmp.x+tmp.y+tmp.z, 1.0/p);
}

vec3 replicate(vec3 p){
	return mod(p, 8.0) - 4.;
}

float distanceFunction(vec3 p)
{
	vec3 t = vec3(1.);
	p = replicate(p);
	vec2 q = vec2(length(p.xz)-t.x,p.y);
  	return length(q)-t.y;
}

vec3 getNormal(vec3 p){
	const float d = 0.0001;
	return normalize(vec3(
		distanceFunction(p+vec3(d,0.,0.)) - distanceFunction(p+vec3(-d,0.,0.)),
		distanceFunction(p+vec3(0.,d,0.)) - distanceFunction(p+vec3(0.,-d,0.)),
		distanceFunction(p+vec3(0.,0.,d)) - distanceFunction(p+vec3(0.,0.,-d))
	));
}

void main() {
	//画面の座標系を左下(-x/y, -1)→右上(x/y, 1)、中心(0,0)に変換する
	vec2 pos = (gl_FragCoord.xy * 2.0 - resolution) / resolution.y;

	//カメラ位置や向きを指定する
	vec3 camPos = vec3(0.0, 0.0, 3.0);
 	vec3 camDir = vec3(0.0, 0.0, -1.0);
	vec3 camUp = vec3(0.0, 1.0, 0.0);
	vec3 camSide = cross(camDir, camUp);
	float focus = 1.8;

	//画面のピクセルに応じてRayを放つ
	vec3 rayDir = normalize(camSide*pos.x + camUp*pos.y + camDir*focus);

	float 	t = 0.0,
		d;
	vec3 posOnRay = camPos;

	for(int i=0; i<64; i++)
	{
	d = distanceFunction(posOnRay);
	t += d;
	posOnRay = camPos + t*rayDir;
	}


	vec3 normal = getNormal(posOnRay);
	if(abs(d) < 0.001)
	{
	gl_FragColor = vec4(normal, 1.);
	}else
	{
	gl_FragColor = vec4(0.0);
	}
}

Unable to run when using NVIDIA GPU

When I use an nvidia GPU with atom (GTX 1060M on Laptop, 1080 on Desktop) veda fails to initialize the WebGL context. It works when I set atom to use intel integrated graphics on laptop.

image

C:\Users\spaghet\.atom\packages\veda\node_modules\vedajs\node_modules\three\build\three.js:21332 THREE.WebGLRenderer: Error creating WebGL context.
WebGLRenderer @ C:\Users\spaghet\.atom\packages\veda\node_modules\vedajs\node_modules\three\build\three.js:21332
C:\Users\spaghet\.atom\packages\veda\node_modules\vedajs\node_modules\three\build\three.js:14891 Uncaught (in promise) TypeError: Cannot read property 'getExtension' of null
    at Object.get (C:\Users\spaghet\.atom\packages\veda\node_modules\vedajs\node_modules\three\build\three.js:14891:22)
    at initGLContext (C:\Users\spaghet\.atom\packages\veda\node_modules\vedajs\node_modules\three\build\three.js:21348:15)
    at new WebGLRenderer (C:\Users\spaghet\.atom\packages\veda\node_modules\vedajs\node_modules\three\build\three.js:21395:3)
    at new SoundRenderer (C:\Users\spaghet\.atom\packages\veda\node_modules\vedajs\lib\sound-renderer.js:88:25)
    at new Veda (C:\Users\spaghet\.atom\packages\veda\node_modules\vedajs\lib\veda.js:145:30)
    at new Player (C:\Users\spaghet\.atom\packages\veda\lib\player.js:62:21)
    at new App (C:\Users\spaghet\.atom\packages\veda\lib\app.js:73:23)
    at new Wrapper (C:\Users\spaghet\.atom\packages\veda\lib\wrapper.js:22:20)
    at Object._activate (C:\Users\spaghet\.atom\packages\veda\lib\index.js:83:19)
    at require.install.then (C:\Users\spaghet\.atom\packages\veda\lib\index.js:80:30)
    at <anonymous>

Receive MIDI CC mesages

REALLY hooked on #VEDAVJ here! Congratulations for the great project!
Is there a way to receive MIDI Control Change CC messages (from MIDI controllers with knobs and faders)?

ISF compatibility

ISF (Interactive Shader Format) is a GLSL file format for VJ apps like VDMX.

https://www.interactiveshaderformat.com/spec

VEDA uses extended format in shaders and .vedarc.
I don't think we need to aim full compatibility with ISF, but some features will help us writing shaders.
Also, it would be great if we could import ISF files from https://www.interactiveshaderformat.com/ or the installer.

Here's the draft of ISF v3.
https://github.com/mrRay/ISF_Spec/tree/Draft-v3

TODO

  • Support PASSES
  • Support INPUTS
  • Importing ISF files

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

video example not working (black screen)

Macbook early 2013.
vUv' not read by fragment shader
WARNING: Output of vertex shader 'webgl_42f24135131e57ca' not read by fragment shader
and [VEDA] config file not found

glslangValidator path

only when custom validator path is specified
i need to toggle glsl twice in order to get working

Veda:Toggle! Doesn't Work

Veda:Toggle doesn't work on atom. It doesn't do anything. And also it only shows once on command palette. When trying to type it for the second time on command palette, it says "No matches found ".

I also tried Ctrl-Enter. That also doesn't do anything to load the shader.

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.