Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Create Blur effect? Window.record?
- - By bigtunacan Date 2015-01-09 22:11
I would like to create a blur or trail effect where on my object and was trying to find a way to do this.  I thought this may be possible using the Window.record method, but didn't see how I would achieve this.  Does anyone have a real basic example of how this could be achieved, or is this not possible?

Thanks
Parent - - By jlnr (dev) Date 2015-01-09 23:15
If you want objects to leave a trail, you can just remember the last (up to) 10 positions and draw the object at that place, but with a colour that has an ever-decreasing alpha channel. You can also try increasing or decreasing the size of images as they fade out, using the scale_x and scale_y parameters. (No code, sorry...)

For a true blur effect, you would probably have to look into GLSL shaders based on Spooner's Ashton library. I've never tried this myself, though.

Window#record does not help here, it mostly exists to speed up batch rendering of thousands of images, typically map tiles.
Parent - - By bigtunacan Date 2015-01-10 01:54
I'm trying to create a permanent blur/trail. Storing in something like an array in my case would result in too many draw calls over time. In other frameworks I have seen a feature where you can draw to an in memory image and then blit that to a window surface.
Parent - - By RunnerPack Date 2015-01-10 08:24
If you just want a fixed, permanent trail sticking out in one direction from an image, you're probably better-off pre-rendering it in a paint program and saving it as a PNG. Sounds kinda boring to me, though...
Parent - By bigtunacan Date 2015-01-10 09:04
That's not what I'm doing.  I'm doing organic life growth type of simulations.  So the trails continue to build up over time showing the patterns.  It's actually pretty cool.
Parent - - By jlnr (dev) Date 2015-01-10 11:03
Oh, permanent :)

In that case record is indeed relevant. But it does not render to a texture, it only groups a lot of Image#draw calls into a vertex array, so it is not unlimited. And you cannot add to an existing, recorded macro.

Ashton has render-to-texture functionality, but I don't know how well it works: https://github.com/Spooner/ashton

Only that would allow your simulation to go on forever.
Parent - - By bigtunacan Date 2015-01-11 03:55
Thank you.  It looks like the Ashton::Texture is what I'm looking for.  I'm running into an issue that appears to be a bug with Ashton; I'll see if I can figure that out.
Parent - By lol_o2 Date 2015-01-11 12:26
Currently rendering to texture is broken with fullscreen.
Up Topic Gosu / Gosu Exchange / Create Blur effect? Window.record?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill