RM Skill: Intermediate
RGSS Shader System
Version 1.0 Author JoaoB ("João B" on Brazilian forums) Release Date May 9th 2010
Introduction "A shader is a RGSS class with special methods used to apply pixel-level effects in bitmaps." Sorry, but there's no way to hardware-accelerate this script (well, RGSS itself isn't hardware-accelerated). This script is slow, specially in RGSS2, but there are some uses.
Easy shader creation using the def [tt]Shader::apply(x, y)[/tt]
def copy copy_bitmap = Bitmap.new(self.width, self.height) copy_bitmap.blt(0, 0, self, Rect.new(0, 0, self.width, self.height)) return copy_bitmap end end #=============================================================================== # End of script #===============================================================================
#=============================================================================== # RGSS Shaders System (shader definition) #------------------------------------------------------------------------------- # Author: JoaoB # WARNING: Place this script AFTER "Shader System" # Script where the shaders will be defined #===============================================================================
def self.apply(x, y) color = @@bitmap.get_pixel(x, y) bw = color.red*0.3 + color.green*0.59 + color.blue*0.11 return Color.new(bw, bw, bw, color.alpha) end
#=============================================================================== # End of script #===============================================================================
Documentation shaders.html ( 5.75K )
Number of downloads: 50
Customization Well, the customization possibilities are almost infinite. I said "almost" because it depends on the bitmap size, shader complexity and other things. Attached is an HTML file with instruction.
Compatibility It's compatible with any other script you post. In addiction, there's the def [tt]Bitmap::copy[/tt], which returns a copy of the bitmap, not the bitmap itself (yes, there are differences).
Screenshot There are various effects you can achieve with this script; no number of screenshots can show all of them.
This is a screenshot of one of the shaders that come with the script.
The same shader, on RMVX.
Installation To install the script, copy the scripts Shader System and Custom Shader in that order. To create and apply the shaders, see the attached HTML file.
FAQ Q: Does it work on RMVX? A: Yes, it does, but it's much slower.
Terms and Conditions Well, you can use it freely in your game, but please, give me credit if you use it and let me know if you post it in another forum.
Credits The system was made by me, but the inspiration came from Adobe Pixel Bender.
A skilled scripter presenting itself to the biggest Maker community in the world.