Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

GLSL Shaders

RGLSL
RGSS OpenGL Shader Language


This project aims to create an API for RGSS3 games so OpenGL rendering can be performed against given bitmaps.

This will eventually lead to a 3D API for drawing 3D graphics in RPG Maker games, but for now it's good for post-processing shaders.

Guide
  • Download project
  • Run it, talk to the other person on the map
  • After you've had fun, open the script editor and study the Shader section
  • Inspect Scene_Map lines 20 and 68, they run this process on the map scene
  • Inspect the other person's event (Simple enough)
  • Modify an existing shader and see what happens Warning! Currently there is no shader compile failure output! This is a bug and will be solved in the future! Error output will be in version 0.02
  • Write your own shaders and put them in the Shaders folder

How to use this in your project
Copy the custom Game.exe into your project and then you will be able to use the new functions (Follow the guide above and the instructions in the script itself for important info).

Download Demo
REMOVED!

Screen-shots
These are all real-time shots, not photo-shopped effects (See for yourself, download the demo)
screens.png

New! GB Palette
ayTVkSu.png


Video
http://www.youtube.com/watch?v=2wmTbgFIzEY

Project plans
Once the API is settled I'll be porting this to a DLL so the default Game.exe can run it. There will be a performance hit compared to the custom Game.exe (Which will still be updated) so beware of this now.

As I said above, this will most likely lead to a full 3D API for RPG Maker games, so you'll be able to do 3D rendering onto a bitmap. A lot of work will need to be done to get the standard RPG Maker graphics drawing through this system, though, and I'm not going to be the one who does that (I barely know Ruby as it is!).

One big problem right now is that the only way to grab the game screen (That I can see) is Graphics.snap_to_bitmap, I want to eventually find a way to run a shader on any point within the default rendering path (Eg, make only sprites blurry or make the map background pink or all water-autotiles blur and tint blue any object that is on top of them).

Stuff you are probably thinking
What is this?
This means you can perform post-processing special effects on RGSS bitmaps.

I don't even-
It's an API for scripters, so if you don't understand then you're probably not a scripter.

How?
I created a modified Game.exe that binds some functions written in C/C++ to the current RGSS module (Tested only with RGSS3 so far, other RGSS versions are not yet supported).

I've seen these before and they were slooowww!
Yeah, well, those were done on the CPU, this uses your graphics card to do the complex calculations and rendering, so this is actually pretty fast (Please report your frame-rates, I'm at solid 60 but I have a rather beefy system).

Do I need a good machine for this?
You'll need a graphics card that supports OpenGL 3.0, ideally OpenGL 4.0 (The version tested with).

Known problems
  • Currently no-way to intercept the draw order to post-process at various stages (I am working on this so one day it will be possible :smile: )
  • The back buffer size is defined by the first bitmap bound to it (The fix is first bind a bitmap that is the same size as the game resolution)
  • No compile failure output (I have no clue why the code isn't working, it's supposed to dump a file on failure :mystery: ) Solved it, will be in next version
 
Oh wow! I always wanted access to shaders for their power, I've tried replicating them but like you said they killed the FPS when used. I'd love to be able to use shaders on various images for a variety of effects. I can't run the demo though, it just crashes (Game.exe / xiGame.exe has stopped working), here's the problem signature:

Code:
 

Problem signature:

  Problem Event Name:   BEX

  Application Name: Game.exe

  Application Version:  0.0.0.0

  Application Timestamp:    52d6eac4

  Fault Module Name:    StackHash_0a9e

  Fault Module Version: 0.0.0.0

  Fault Module Timestamp:   00000000

  Exception Offset: 1005f270

  Exception Code:   c0000005

  Exception Data:   00000008

  OS Version:   6.1.7601.2.1.0.768.3

  Locale ID:    1033

  Additional Information 1: 0a9e

  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789

  Additional Information 3: 0a9e

  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

 

With Windows 7 Home 64-bit. It might be a DEP issue, I have my computer set to opt-out mode instead of opt-in, but I can't test it since I can't add Game.exe to the opt-out list. I'll try turning it off when I get the chance and report if it is the cause of the issue or not.
 
That would probably have been handy to include in my post! I've got a 7870 with 2gigs of vram running OpenGL 6.14.10.12422. I'm not on my latest drivers but I trust GPU drivers about as far as I can throw them and I generally don't update if everything works (13.9 catalyst version, 13.152 drivers)
 
GreatRedSpirit":29olq4he said:
That would probably have been handy to include in my post! I've got a 7870 with 2gigs of vram running OpenGL 6.14.10.12422. I'm not on my latest drivers but I trust GPU drivers about as far as I can throw them and I generally don't update if everything works (13.9 catalyst version, 13.152 drivers)
OpenGL 6.14.10.12422 is your driver version, I need your API version which you can find with this tool: http://www.realtech-vr.com/glview/ (GL Version should be 4.4 or lower, if it's 2.1 then it certainly won't work)

At the moment I'm trying to get this working for NVidia GPUs, so when I solve that perhaps that might solve any issue you have (So does it crash the moment you open the Game.exe or can you get anywhere within the game?).
 
I have OpenGL 4.2 according to OpenGL Extensions Viewer (4.3 is 77%, 4.4 is 10% supported). Both Game and xiGame crash immediately when I open them.
 
That's pretty badass! At some point I wanted to do the same for my FF6SDK but instead I might port it to something better suited for operation like that such as XNA or SFML. But still, I'm happy to see you managed to to that, good job man! :)
 
182-44af3a7.png

Build in Multi-Threaded mode x) (Configuration and Properties => C/C++ => Code Generation => Runetime Library = Multi-threaded (/MT) instead of Multi-threaded DLL (/MD))
 
Nuri Yuri":109d9krc said:
182-44af3a7.png

Build in Multi-Threaded mode x) (Configuration and Properties => C/C++ => Code Generation => Runetime Library = Multi-threaded (/MT) instead of Multi-threaded DLL (/MD))
I've already done that for versions that I've given out to specific testers, this project is pretty much abandoned as it doesn't work on NVidia GPUs and is too slow on Intel GPUs to be worth-while.

I've been doing more research on this and I have a new solution that I will be investigating in the future, but for now; project abandoned.
 
Glitchfinder":6b3zl37e said:
This doesn't work on nVidia GPUs at all? And here I was messing with the shaders and trying to get them to compile for myself.
I think my GL setup code doesn't work, all shaders just produce a solid coloured rectangle taking up 25% of the screen at the top right.

I have a new method that I know works on NVidia GPUs, but the speed of copying the RMVXA bitmap onto a GL texture is too slow on Intel still to make it worth while, on top of that the screenshot function of RMVXA is crazy slow.

What would be nice is if we could intercept the rendering path of Game.exe and apply it as real post-processing, grab the final frame buffer from the GPU itself in a GL context, I just don't know enough about the Game.exe's guts or the RPG Maker rendering system to do that.

On the plus side, it's still fast enough to draw OpenGL 3D shapes onto an RMVXA bitmap, so having 3D rendered scenes using bitmaps as a frame-buffer is still possible.
 
Yeah. I don't see any reason why you should have RMVXA's bitmaps if you already can use GL textures. :)

As far as GLSL goes, if I were you I would try to keep compatibility to the max if you are planning for this to be used in commercial projects. Believe it or not there are still some people with older GLSL versions (mine included :)).

Sure it leaves out many of the new features, but that's the trade-off you'll need to make. :/
 
Drago del Fato":1cbp55pd said:
As far as GLSL goes, if I were you I would try to keep compatibility to the max if you are planning for this to be used in commercial projects. Believe it or not there are still some people with older GLSL versions (mine included :)).

Sure it leaves out many of the new features, but that's the trade-off you'll need to make. :/
100% the reason why I've put this on hold, because GPUs still have different behaviour to each other it's crucial to try and maintain maximum compatibility.
 

Ryaryu

Member

Hmmm....
Can't you pick all graphic information on screen (X/Y positions, HUE, Color, Zoom X/Y, Rotation, Crop position, etc) and send them directly to a OpenGL Handler that will effectivly draw the entire scene? Maybe sending all this info in real-time is a better solution than work with RPG Maker's bitmaps...
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top