GLSL Shader Shrinker

I have written many GLSL shaders over the last few years, most of which can be found on the Shadertoy website, and over time I’ve built up some code which I use as a ‘starting point’ for ray-marched scenes.

An example of one of my ray-marched scenes.

After writing a shader I then review the code to delete any unused functions, simplify calculations, and optimize performance, and generally get things into a state where I don’t mind people taking a look.

It occurred to me that much of this process can be automated, so I wrote a Windows tool which does just that:

GLSL Shader Shrinker

The C# source (and prebuilt Windows installer) can be found on GitHub at this location:

https://github.com/deanthecoder/GLSLShaderShrinker

See here for a full list of features.

Arduino Code – Performance

I’m currently making a self balancing robot, powered by an Arduino Nano, and decided to use NEMA 17 stepper motors to power it.

The DRV8825 motor drivers are great, but cannot be driven using a PWM signal. Consequently the Arduino code must send a ‘step’ signal to the correct pin many times per second – Easily in the thousands if you require a decent amount of speed, especially if you’re micro-stepping.

Performance is critical…

Continue reading “Arduino Code – Performance”

Arduino Code – Logging

Needing to write output to the Arduino IDE’s ‘Serial Monitor’ is something you might find yourself doing a lot. It’s one of the easiest ways of giving feedback on variables, and is invaluable when it comes to debugging.

To output content you can use code like this:

Serial.println("Hello world");

All good so far. How about if you want to output a variable? That’s slightly more work…

Continue reading “Arduino Code – Logging”

Useless Box – The Code

The Code

For anyone planning on making their own ‘Useless Box’, you might find my Arduino Sketch(/code) useful as a starting point.  The version I’m using here is not my final version, which adds more ‘character’ at the expense of code readability.

You’ll have to tweak the fingerMin/fingerMax and lidMin/lidMax values to suit your own designs, but hopefully that should be quite straight forward.

If you find the code useful, or develop or further, please let me know!  It would be great to see others getting some benefit from it!

Continue reading “Useless Box – The Code”

Useless Box – Final Result

Here it is – The final result!

Powered using an Arduino Uno, two ‘reclaimed’ servos, and a handful of Lego blocks.  Great fun to make, a good starting project for people interested in Arduinos, and a lot of fun to use!