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();
};