Blur effect to apply to a material

HI all,

I wanted to apply blur effect.
I found this project
http://playcanvas.com/will/blur

In this project the blur effect is being rendered to the scene itself.
But I want it to apply to a material and use it on some object.

I traced the whole thing and found the following part of the code is doing the blur effect and applying to the whole scene.

var command = new pc.scene.Command(pc.scene.LAYER_FX, pc.scene.BLEND_NONE, function () {
    blurEffect.render(target, null);
    entity.camera.renderTarget = target;
});

this.app.scene.drawCalls.push(command);

Somehow this has to be applied and stored in probably rendertarget and I can use it apply to some material.
like in the following code

Applytexture.prototype.postInitialize = function() {
    var cameraEntity = this.opticalCamera;
    var material = this.entity.model.model.meshInstances[0].material;
    material.diffuseMap = cameraEntity.camera.renderTarget.colorBuffer;
    material.update();
};

Waiting for some help on this.

So in this file: https://playcanvas.com/editor/code/6432/blur.js
Line 162 sets render target to camera, and few other lines.
On line 169 it calls render, with output target to null, if you change it to another texture, it will render into it.
And then you can use that texture on material simply setting it on appropriate map (diffuseMap or emissiveMap).

Thanks Max. It worked. I was also trying by passing a texture but somehow missed on applying successfully. (I was missing on applying colorBuffer of the texture instead went on take directly the texture.)