Add glow to Image (Actor) in LibGDX - libgdx

Is it possible to add a glow to the outline of an Image? I know I can do this by adding an additional "glowed" version of the image and switching to it when desired, but since there are many different shapes in my game, I would prefer the glow to be done programmatically. How can I do this?

As #Metaphore mentioned, shaders are indeed the best option I found. I've succeeded in adding an outline to any desired image in my game by following this article and by getting crucial information from asking a follow up question.

The only way to do this is to use your own pixel shader when drawing this particular image.
You can find a lot of glow effect shaders on the net and there are may tutorials how to use them as well. You may check official LibGDX article on this topic https://github.com/libgdx/libgdx/wiki/Shaders
However, I'd not recommend you follow that way, because using different shaders for drawing single images will make you render cycle code much more complicated and less optimal. So either you will compromise on it, or just find easier way to achieve such behavior without shaders (I mean draw it statically somehow).

Related

AS3 Outline with glowfilter on partly transparent objects

My problem is that I have some objects I want to create a highlight around. Currently I am using glowfilter to do this, it works perfectly fine most of the time. But when I have partly transparent objects I get a problem, for example, a window, since the glass in the window is transparent the glowfilter will be visible through it.
Is there a solution on how to make a nice outline, without having to worry about transparency?
Thank you in advance!
OK there are two answers, one is easy and non-coding based, and the other requires the first answer plus coding and is non-trivial.
Easy answer: Don't use transparency. Flatten the source image, copy your part, and put a GlowFilter on it. Simple, and probably the way you should go.
Not easy answer: What you're seeing is the normal behavior for Bitmap filters. Instead, you will need to use a combination of at least two bitmaps, one without any interior transparency (same image part as in the Easy answer) that uses a GlowFilter with the knockout parameter set to true, and the other identical bitmap, without a filter, placed directly over it if you are intending to slide things between the device and the highlight. Doing this is way beyond the scope of a simple question, and you should research it if the Easy Answer doesn't do it.

how to achieved sprite reflection in libgdx

I am currently working on an open world game like pokemon using libgdx.I am currently stuck on this effect that I really want to be done before moving to other features of my game. do you have any idea how to achieve this reflection effect? .concept behind?
https://gamedev.stackexchange.com/questions/102940/libgdx-sprite-reflection
For basic reflection, to draw a texture flipped vertically you can simply scale its height by -1. Then simply redraw the texture an appropriate distance under the player.
You shoudl also add a clipping rectangle around the water's edge so the reflection only draws where the water is. For perfomance purposes, it would also be good to only do this when the player is near water.
I can't give you actual code as I don;t know anything about your code, but once you've had a go at handling reflection as abaove, come back here and ask any more specific questions taht you may have.
This question is too broad and opinion based and hence is highly likely to be voted down.

AS3 Detecting Borders in Bitmap

I need a library which, fed with a bitmap, returns me an array of rectangles with coordinates and dimensions of the different areas found in the image.
I'll give a graphic example:
From this:
I want this:
Or from this:
I want this:
Is there such a library?
If I want to write one on my own where can I start to inform myself about it?
To my knowledge, the best you'll find are image filters, and color conversion methods, but not the kind of complicated edge detection you're looking for.
Of course, your query supersedes the canny edge detection, and is focused on image boundaries, but I've found no material on that even beyond AS3.

CSS / HTML5 Shape Tween / Morph?

I've discovered ways to transform css shapes using animations like the ones demonstrated here: http://matthewlein.com/ceaser/
Does anyone know if it is possible to get more advanced with CSS or other non-flash code, to create animations more complex - even along the lines of the effect you see when minimizing or maximizing windows on Mac OS toolbar?
Is that possible or out of the realm of possibility using css?
Thanks,
This should be enough to get you started:
http://jsfiddle.net/9BTPy/
Notice that I only made a sample for Firefox for simplicity. Otherwise the code would get too big. It is also not the effect from your question, but you should get the idea.
Also see the following links for documentation and other examples:
http://css3please.com/
http://www.w3schools.com/cssref/css3_pr_keyframes.asp
http://www.w3schools.com/cssref/css3_pr_animation.asp
Additional Notes:
If you really have to do it this way, you are off way better with jQuery-Animations. The support over the different browsers is better, and it may be even simpler to do the effect you describe. It's also way nicer to maintain. :)

Image Processing and Effects in ActionScript-3

I want to implement various effects like Sepia, GrayScale, Posterization etc. on BitmapData in ActionScript-3.
How to do this and What is most efficient way to do this ?
Thanks in advance!!
The most efficient way to do image processing would be to use Adobe Pixel Bender. This is basically a pixel shader like language that can be used to create filters for Photoshop, After Effects and Flash. There is also an exchange where developers share filters.
Here is a tutorial on how to load pixel bender filter into flash.
There is more information available if you search Google for "pixel bender flash".
This post explains how to do the GrayScale:
AS3:How to change a colored Bitmap's BitmapData to black and white?
Sepia is a combination of grayscale and tinting. Tinting is typically accomplished by multiplying one of the colour channels by a certain amount to boost that colour.
The techniques illustrated in that post are the way you should proceed. You'll have to look up the per-pixel filtering algorithms, but many of them exist on wikipedia or math sites.