Hey all!
I was experimenting again to see if an object outline effect (think Left 4 Dead) could actually be done in the UDK. This time I got it working so I decided to share it.


The technique involves using 2 meshes. One uses the usual solid material with lighting or whatever else you want on it. The second mesh uses a translucent material with depth based edge detection. Here's the material:
[SHOT]http://farm8.staticflickr.com/7031/6483365243_b2438950ba_b.jpg[/SHOT]
Not so easy to fit the whole material on one screenshot.
The stuff connected to Emissive is just to make the highlight color pulse. 'Normalize' is switched on on the SceneDepth and PixelDepth nodes. 'Screen Align' is switched on on the ScreenPos node. The 'Width' parameter controls the outline thickness, the 'Depth' param controls the depth threshold of the edge detection. Setting 'Depth' lower avoids outlines disappearing when your mesh is near other geometry, but causes smaller features to also get outlines.
This material uses 4 depth samples to check depth differences. More could be added to improve quality, but at the cost of more instructions.
Hope someone finds it useful, have fun.
I was experimenting again to see if an object outline effect (think Left 4 Dead) could actually be done in the UDK. This time I got it working so I decided to share it.


The technique involves using 2 meshes. One uses the usual solid material with lighting or whatever else you want on it. The second mesh uses a translucent material with depth based edge detection. Here's the material:
[SHOT]http://farm8.staticflickr.com/7031/6483365243_b2438950ba_b.jpg[/SHOT]
Not so easy to fit the whole material on one screenshot.
The stuff connected to Emissive is just to make the highlight color pulse. 'Normalize' is switched on on the SceneDepth and PixelDepth nodes. 'Screen Align' is switched on on the ScreenPos node. The 'Width' parameter controls the outline thickness, the 'Depth' param controls the depth threshold of the edge detection. Setting 'Depth' lower avoids outlines disappearing when your mesh is near other geometry, but causes smaller features to also get outlines.
This material uses 4 depth samples to check depth differences. More could be added to improve quality, but at the cost of more instructions.
Hope someone finds it useful, have fun.

Comment