Get edge detection post effect pixel value
I am struggling to extract pixel values from either a Depth Texture or, preferably, an Edge Detection Post Effect material (like found in the Depth Materials template, Edge Detection Example, edge_detection material).
I can get the RGBA value from a regular texture, like a Device Camera Texture like:
// @input Asset.Texture deviceCameraTexture
var procTex = ProceduralTextureProvider.createFromTexture(script.deviceCameraTexture)
var data = new Uint8Array(4)
var x = 100
var y = 100
procTex.control.getPixels(x, y, 1, 1, data)
print(data[0] + ", " + data[1] + ", " + data[2] + ", " + data[3])
Ideally, I would like to know: at a screen coordinate, is it an edge or not? I cannot find which object holds post effect pixel values.
I would also like to know how to get an RGBA or depth value from a Depth Texture. If I use the getPixels approach above with a Depth Texture, all pixel results are [255, 0, 0, 255]. Any ideas?
For the depth texture, I know that the segmentation textures under the hood aren't quite the same as say the device camera texture, so you may need to output that to a render target first.
To get the post effect pixel values, you'll need to output your processed image to a separate render target. I would setup a camera, layer, and render target for just the post effect (or depth map), then use that render target as the input texture for your script.
If you aren't familiar with render targets here is a tutorial: https://arbootcamp.com/snapchat-intermediate/multiple-post-effects