top of page

What work was done

The goal of the project was to develop a shader editing tool for the Processing Development Environment (PDE) that updates the PDE sketch display window in real-time. It was decided to use an existing open-source shader editor as the starting point as building the entire tool from scratch would be impossible to complete within the 3 month time period of GSOC. After searching a number of options, Shdr was chosen as the starting point.

The first two challenges faced were that Shdr was a web-based app and was programmed in javascript, while the PDE is a desktop app programmed in java. The first issue was solved by generating a desktop app of Shdr using electron(a tool to build cross-platform desktop apps) and Node.js. The issue of language difference was solved by making both the apps communicate over a network using inter-process communication (IPC) where a server created inside PDE listened for a client created in Shdr. IPC was initially used to inform PDE to compile it's default shader whenever the text editor inside Shdr was updated by the user. However this was later replaced by a simpler solution in which PDE checked the time stamps of it's local shader files to update it's display window. IPC was used to send location of the sketch shader files to Shdr so that it could read and write(when user edited Shdr editor) to them. Once IPC was smoothly running, different case scenarios for using the Shader Editor tool were taken care of. These were:

  • creating data folder inside the sketch folder if it was absent

  • creating default shader files inside data folder

  • storing Shader Editor contents to temp folder if sketch is untitled

  • sending updated path of data folder to Shader Editor once untitled sketch is saved

 

What work is left

Though almost all the basic targeted features of the Shader Editor tool were implemented, some were still left unaccomplished because of time constraint and the challenges they posed. One of them was solving the naming conflict between some of Shdr and PDE's default shader uniform variables. Since this issue was unsolved, Shdr is unable to show a visual output in it's own rendering window when user declares uniform variables inside the Shdr's text editor that are unrecognizable by it. This also meant that uniform variables passed to the Shdr from the sketch would have null/zero values as well. 

For now, Shader Editor would only work for exactly two shader files i.e vertex and fragment file. It would not work if any of them is missing(when PDE uses it's default vertex shader).

Challenges

A number of challenges were faced while working on this project. One of the biggest challenges was understanding and getting familiar with the Shdr code without any documentation. This was followed by getting familiar with JavaScript, a language I was new to.

The next big challenge was creating a smoothly running IPC system between the PDE and Shdr and within electron between the main and renderer process. Making sure that both the IPCs worked simultaneously was also a challenge as sometimes one would block the other. The initial IPC system had to go through a number of iterations before it was able to accomplish all the required tasks. These iterations were spread out throughout the 3 month period, taking place as more features were being added. These challenges have been explained in detail in the weekly reports

Another challenge that was faced towards the end was updating sketch shader files location inside Shader Editor in real-time when the current untitled processing sketch was saved and also store the shader files contents to a temporary location before sketch was saved. A major portion of the solution to this problem involved IPC.

Other minor challenges included finding the most appropriate existing open-source shader editor as a starting point. A lot of research was done to find the right tool at the beginning of the project.

Future work

Since Shader Editor is not a complete tool, there is room for a lot of features. Some of these include the following:

  • support for shader without vertex shader

  • support for multiple shader files (i.e more than 2)

  • resolving the naming conflict between uniform shader variables in processing and Shdr

  • making Shader Editor recognize external uniform variables or passing their value to Shader Editor 

 

Repositories and Commits

The project was started by initially forking the processing-tool-template. Later forked repository was replaced with a downloaded version and more sub project folders were added that included Shdr-master(Shdr source code), processing(source code) app, core and java projects. For the shader testing phase, a project by the name of P3D-test was also added to test processing shaders without compiling and running the PDE repeatedly.  All changes were pushed to the master repository  GLSL-Editor-Processing on GitHub. 

Initially Shader Editor tool was run through terminal for debugging purposes but was later done by calling an executable generated by electron-packager. These executables have been uploaded as binaries inside the Shader Editor tool package in GitHub releases. 

Shader Editor Tool

Source code repository

Released tool versions

Tool package

 

Changes to the source code repository have been tracked as commits.

Shdr-PDE-3.JPG

GLSL Editor for PDE

Final Report

bottom of page