https://github.com/polyfloyd/cube-shaders
Animations for my 3D LED-Cube written in GLSL
https://github.com/polyfloyd/cube-shaders
glsl shadertoy
Last synced: 5 months ago
JSON representation
Animations for my 3D LED-Cube written in GLSL
- Host: GitHub
- URL: https://github.com/polyfloyd/cube-shaders
- Owner: polyfloyd
- Created: 2018-05-06T14:57:42.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-15T23:26:18.000Z (over 7 years ago)
- Last Synced: 2025-06-06T05:04:24.414Z (about 1 year ago)
- Topics: glsl, shadertoy
- Language: GLSL
- Homepage: https://polyfloyd.net/post/opengl-shaders-ledcube/
- Size: 23.2 MB
- Stars: 13
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
LED-Cube Shaders
================
This repository contains GLSL animations for my LED-Panel-Cube to be rendered
using [Shady](https://github.com/polyfloyd/shady).
## Usage
All animations for the cube should define a `mainCube` function as entry point
along with some boilerplate:
```glsl
void mainCube(out vec4 fragColor, in vec3 fragCoord) {
// Animation code goes here...
}
#ifndef _EMULATOR
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
mainCube(fragColor, cube_map_to_3d(fragCoord));
}
#endif
```
The `mainImage` function renders for the actual cube. It is wrapped in an
`ifndef` so the emulator is allowed to redefine the `mainImage` function.
### Emulator
I've written a shader that acts as an emulator for the cube. It works by
defining a `mainImage` function that raymarches a cube and for each pixel on
the surface, calls `mainCube`.
Quick test:
```sh
shady -g 1366x768 -i emulator.glsl -i anim/globe.glsl -ofmt rgb24 -framerate 20 \
| ffplay -loglevel quiet -f rawvideo -pixel_format rgb24 -video_size 1366x768 -framerate 20 -i -
```
## Rendered







