I am working to get a Webcam Texture piped into the _EMISSION node of a default shader. I have created a custom material to take the input, but for some reason, it’s not working as expected.
I can get it to pipe into the mainTexture, just not into the Emission. Incidentally, I am using the mainTexture to take advantage of the alpha channel, so I don’t want the main channel as my webcamTexture. I can set all of this up and working using regular single texture maps, just wanting a live image in the Emission.
Here’s the code thus far…
#pragma strict
private var webcamTexture1 : WebCamTexture;
var plane1 : Transform;
var plane1 : Transform;
var myMaterial : Material;
function Start () {
webcamTexture1 = WebCamTexture();
var renderer: Renderer = GetComponent.();
var devices : WebCamDevice[ ] = WebCamTexture.devices;
if(devices.length > 1){
webcamTexture1.deviceName = devices[0].name;
myMaterial.EnableKeyword (“_EMISSION”);
myMaterial.SetTexture(“_EMISSION”, webcamTexture1);
webcamTexture1.Play();
}
}
Any help here is much appreciated.
Cheers!

