Extending Ren'Py visuals with custom OpenGL shaders
Posted: Tue Sep 27, 2016 1:11 pm
I hope this is the right forum section for this.
While slowly working on own visual novel, I have been doing some experiments to add more control to the Ren'Py visuals by using OpenGL vertex- and pixel-shaders. Ren'Py already uses OpenGL and shaders in many cases if they are available, but it has been abstracted away from normal users (maybe to increase portability, which is not a bad goal at all).
If you are not familiar with any of that jargon, in practice shaders make possible for us to perform complex, customizable, real-time image manipulation within Ren'Py. This includes many effects from simple color adjustment to heavy image distortion. An image is better than a thousand words, so here is a video demonstrating some of the possible effects:
https://www.youtube.com/watch?v=nyDbvAy0Xa4
That video contains some basic things you can do with it. Waving hair, eye/mouth distortion to change expressions and that kind of stuff. It even supports 3D-rendering.
The project is still VERY experimental, so don't use it in any production work. If you want to try it out here is the source code for it: https://github.com/bitsawer/renpy-shader It would be great to know what kind of systems does it even run on. I have tested it on a few relatively new computers (Windows and Mac), so feedback about that would be nice. It should work on Linux, too, but I haven't tested it yet. Android and iOS could be supported in the future, but that is not a priority right now. If it crashes or doesn't work, it would be nice to get the error stack trace (it's usually in the log.txt file) so I can improve the library.
I was surprised how little I had to abuse Ren'Py, but there are some hacks in my code that probably require some minor changes to the Ren'Py itself. At the moment those modifications are done at runtime by reaching into Ren'Pys undocumented internals, which works but is not very safe or futureproof. Still, using custom Displayables together with screens turned out to be a pretty flexible solution. There is also some room for optimizations, so if things run slowly there is no need to despair yet.
Any comments and feedback is welcome. What kind of visual effects have you always wanted to do to your images in your visual novels?
While slowly working on own visual novel, I have been doing some experiments to add more control to the Ren'Py visuals by using OpenGL vertex- and pixel-shaders. Ren'Py already uses OpenGL and shaders in many cases if they are available, but it has been abstracted away from normal users (maybe to increase portability, which is not a bad goal at all).
If you are not familiar with any of that jargon, in practice shaders make possible for us to perform complex, customizable, real-time image manipulation within Ren'Py. This includes many effects from simple color adjustment to heavy image distortion. An image is better than a thousand words, so here is a video demonstrating some of the possible effects:
https://www.youtube.com/watch?v=nyDbvAy0Xa4
That video contains some basic things you can do with it. Waving hair, eye/mouth distortion to change expressions and that kind of stuff. It even supports 3D-rendering.
The project is still VERY experimental, so don't use it in any production work. If you want to try it out here is the source code for it: https://github.com/bitsawer/renpy-shader It would be great to know what kind of systems does it even run on. I have tested it on a few relatively new computers (Windows and Mac), so feedback about that would be nice. It should work on Linux, too, but I haven't tested it yet. Android and iOS could be supported in the future, but that is not a priority right now. If it crashes or doesn't work, it would be nice to get the error stack trace (it's usually in the log.txt file) so I can improve the library.
I was surprised how little I had to abuse Ren'Py, but there are some hacks in my code that probably require some minor changes to the Ren'Py itself. At the moment those modifications are done at runtime by reaching into Ren'Pys undocumented internals, which works but is not very safe or futureproof. Still, using custom Displayables together with screens turned out to be a pretty flexible solution. There is also some room for optimizations, so if things run slowly there is no need to despair yet.
Any comments and feedback is welcome. What kind of visual effects have you always wanted to do to your images in your visual novels?