I’m implementing a new feature and I could use a bit of sage advice from someone more experience with graphics rendering.
The goal is to render the entire set of lyrics of a song using 3D text on-screen with various shaders (often the same, but not always) applied to every line of text. Each line of text should have its own translation/rotation. The resources for rendering are to be made available (and released) real-time for various songs, not specified in advance.
I’ve come up with two approaches in mind, and a set of pro’s and con’s to each, and I’m hoping to gather a bit more wisdom regarding each, and possibly even a strong suggestion to which might be ideal in the long term.
Once the song to use has been decided, create one
ci::gl::BatchRef per each lyric line, put these in a big vector and render with each shader and translation/rotation as needed.
- Implementation-wise fairly straight-forward - one
ci::gl::BatchRefper lyric line
- Rendering each line with its own translation/rotation/shader(s) is super easy
- Graphics meshes indirectly tied to the songs which isn’t as pretty as approach two
- Each song requires a fair amount of resource acquisition upon load
- Possible high use of Vao, Vbo (one per batch)
Create a sort of text-character atlas, one
ci::gl::BatchRef for each symbol needed. Use instanced rendering and position each letter where needed in each lyric line using said letter.
- Text meshes are created one single time (one for each letter)
- Likely the least resource intensive approach
- Far more complex rendering code - must position each instance of each letter in each lyric as needed
- Not sure if attaching different shaders to different letters is even possible using instanced rendering
Any thoughts on either approach is much appreciated!
Thanks in advance,