open-manifold / Open-Manifold

A free and open-source clone of Rhythm 'n' Face for PC.
Other
10 stars 2 forks source link

GLSL Shader Support #9

Open SuperFromND opened 1 year ago

SuperFromND commented 1 year ago

Right now, Open Manifold levels use a custom system of built-in background effects for handling visuals aside from the main playfield and characters. This works well for implementing Winamp-like effects as level backgrounds without much effort from a level creator, but is quite limiting in what it can do. It can only handle 2D graphics elements - no 3D at all, although polygons are supported thanks to recent SDL2 updates - and only one of these effects, tile, can be directly customized right now, and even then it is limited to just a constant-rate animation.

By contrast, many other rhythm games of a customizable nature (NotITG for example) implement things like GLSL shaders that can be thoroughly customized by a level creator, allowing for all manner of crazy visuals. I think it'd be very interesting if Open Manifold supported GLSL shaders to be used for backgrounds - affecting playfield elements is probably not desirable (the game can be confusing enough to sightread as-is!), but backgrounds definitely could make use of it.

This one is certainly going to necessitate a major rewrite to how graphics work (SDL2 supports OpenGL, but not in conjunction with its own renderer API calls, which Open Manifold uses extensively), but I think it'd be worth it. Probably. As for interfacing with GLSL shaders, Open Manifold already supplies background effects with some data in the form of the bg_data struct:

struct bg_data {
    int song_tick;
    int beat_tick;
    bool beat_advanced;
    int beat_count;
    int start_offset;
    int measure_length;
    SDL_Color grid_color;
};