Help.. How to hide Chromakey in my project?


#1

I’m trying to do chromakey … I found this project in playcanvas where a material is fed with a video and a glsl shader is added to eliminate the green zones. https://playcanvas.com/project/523575/overview/video-chromakeying.
OK perfect. Now I try to do it directly from a camera with RenderTexture. I also added the glsl shader and apparently there is no error in the console, but it just does not happen.

This is the Code i use `/////////////////////// RenderLayerToTexture /////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
var RenderLayerTotexture = pc.createScript(‘renderLayerTotexture’);

RenderLayerTotexture.attributes.add(‘shader’, {type:‘asset’, assetType : ‘shader’});

RenderLayerTotexture.attributes.add(‘layerName’, { type : ‘string’});

RenderLayerTotexture.prototype.initialize = function() {
///////// depth buffer
var colorBuffer = new pc.Texture(this.app.graphicsDevice, {
width: 512,
height: 512,
format: pc.PIXELFORMAT_R8_G8_B8,
autoMipmap: true
});
colorBuffer.minFilter = pc.FILTER_LINEAR;
colorBuffer.magFilter = pc.FILTER_LINEAR;
var renderTarget = new pc.RenderTarget(this.app.graphicsDevice, colorBuffer, {
depth: true
});

var layer = this.app.scene.layers.getLayerByName(this.layerName);
layer.renderTarget = renderTarget;

};

//
//
`. Thanks. The link. https://playcanvas.com/editor/scene/667907


#2

IMG_20181121_113151_949|292x500