Freestyle render in game engine?

So I saw this cool border-lands like feature on the blender wiki, and I had no luck trying to find a way to implement it into a game. If it isn’t possible to use this feature int eh game engine directly, is there a way to fake it? By compositing or otherwise?

You might have to code your own custom edge-detecting 2D filter for that.

Don’t ask me how to do it, there’s a number of other people who know how to create these things in the API.

The most popular way of ‘faking’ this effect is to duplicate the desired mesh, make is slightly larger, change the materials to shadeless and black, and then flip the normals (with backfacing on) so only the edge around the player is visible. As Ace Dragon mentioned its probably best to do it through a script if its more than a few objects.


uniform sampler2D bgl_RenderedTexture;
uniform sampler2D bgl_DepthTexture;
void main()
{
   float depth = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy).r;
   float depth2 = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy + vec2(0,0.002)).r;
   float depth3 = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy + vec2(0.002,0)).r;
   
   float fac = abs(depth-depth2) + abs(depth-depth3);
   
   float intensity = 500;
   vec4 sub = vec4( fac*intensity,  fac*intensity,  fac*intensity, 0);
   
   gl_FragColor = texture2D( bgl_RenderedTexture, gl_TexCoord[0].xy ) - sub;
}

delay-------and----------2d filter -custom - > filter

I think this is from solarLune

1 Like

Try this:

I did my honours on this kinda thing a couple years ago in blender, heres a video tutorial with an outline effect at the end.
https://www.youtube.com/watch?v=X01ZMumRBo8&list=UUn_JHKGwDjv1lY-uMoZeKGQYe if U dont know code that well can fake it like @Thatimster says .
If ur interesed more my honours blog is still online and has a load of different tests to achive freestyle type effects easly for games
http://alshonours.blogspot.co.uk/search?updated-max=2013-04-21T17:34:00-07:00&max-results=7&start=21&by-date=false
This test might be particularly what ur kinda looking for

Hope this helps :smiley:

That’s going to be an extreme waste of resources, there is the toon shader in Maya which you could maybe get a similar affect with but I don’t know how well that imports into Blender.

The method posted above me looks like the best option, might be a bit tricky but that looks like the right sort of effect.