Using Angelscript for a type of post-processing
I've been working on a 2D animator, and I've decided I'm to the point where I want to allow the user to code their own post-process effects. Is it viable to pass a buffer of chars about the size of 1280*720*4 to the script for processing? Are there any things i should be aware of to speed it up?(Note: It most likely will not need to be realtime, and if it will be, I'll scale the screen size down to 1/4 or something so it will have to process less)
Well first question why not use a shader?
Anyway i guess you thought about that and it doesn't make sense in your case....
So do it like the gpu to speed up the process...split the screen into several blocks and process every block on its own in several threads with your script code.
Anyway i guess you thought about that and it doesn't make sense in your case....
So do it like the gpu to speed up the process...split the screen into several blocks and process every block on its own in several threads with your script code.
Well, I want to be able to store all kinds of variables across multiple frames first of all. Using angelscript, I can easily do that with the global variables. It's also not limited by instruction limits or hardware. You can also do, say, a blur in both directions without having to have an intermediate texture. I could use shaders, but to me there are some key disadvantages and a lot more work to supply the necessary options to achieve the same effect. They might come later if angelscript proves to slow for this though, but angelscript seems like at the very least a good prototype with how simple everything I need can be implemented.
AngelScript is definitely capable of doing non-realtime postprocessing. I think you could get some ideas on how to implement the system from my rather old texture generator. It uses an early version of AngelScript to generate the textures, which is really similar to postprocessing in many ways.
However, as you are probably very well aware, scripting is many times slower than native C++ code, so you will want to provide the more common postprocessing functions as native functions to the script (e.g. blur, color transform, emboss, etc), and just leave the more unique processing to the script.
Regards,
Andreas
However, as you are probably very well aware, scripting is many times slower than native C++ code, so you will want to provide the more common postprocessing functions as native functions to the script (e.g. blur, color transform, emboss, etc), and just leave the more unique processing to the script.
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Hmm, I looked at your site just earlier today to download the latest version, but now it's down. Anyway, how would I register a c++ function to the script for it to use the blur and other functions? Would I define it as CScriptArray blur(), and register it as array<int> blur()?
I'm not sure what happened, the site is back up now without any intervention from me.
Anyway, I think it would be best for you to deal with the image buffer as an object, rather than an array of pixels. You can then register that object with the engine, and add the blur effect as a method of it.
In the script it might look like this:
The object can still expose index operators to access the individual pixels for more unique processing.
Regards,
Andreas
Anyway, I think it would be best for you to deal with the image buffer as an object, rather than an array of pixels. You can then register that object with the engine, and add the blur effect as a method of it.
In the script it might look like this:
void postProcess(CImage @img)
{
img.blur();
}
The object can still expose index operators to access the individual pixels for more unique processing.
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement