I'm working on a glow shader (for 2D engine Futile relying on Unity). It works OK but the effect is limited by the texture area. Except from adding a lot of empty pixels around the textures (which would result in un-optimized/too big texture atlases), is there a better solution to cope with this problem? I'm quite new with shaders so maybe this is a classic problem with some well known solutions, maybe I'm not searching with the right keywords.
You don't outline directly on the object itself, but do the outline in a post process step.
- Draw the scene, as if there was no outline.
- Draw the object(s) you want outlined to a new screensized texture.
- Apply the outline shader you already use to combine the images.
You may want to change the shader, so it draw the outline to the screen, without drawing the object itself; since you can draw the object in step 1, the outline will show up nicely anyway.
This has the benefit that if the object is obscured the outline will show the entire object. For example when the wizard is behind a tree, the tree will show but the outline shows the entire wizard. This is often used in games where hilighted objects may be hidden depending on the camera orientation.