I have a script that moves a camera around many times in one frame. I need to capture 1x1 pixel color of the camera each time I move it to another predetermined point.
I am currently using a rendertexture and assumed I could pull out a single pixel from there to get what I wanted, but it seems to output the same color over and over even when the camera is looking elsewhere (dark grey).
Here is roughly what I am attempting; where have I gone wrong? Thanks!;
public RenderTexture vertexColorOutput;
public Camera vertexCamera;
[...]
public void THEFUNCTION()
{
Texture2D output;
for (int i = 0; i < NUMBER; i++)
{
output = new Texture2D(1, 1);
vertexCamera.transform.position = positions*;*
vertexCamera.transform.rotation = rotations*;*
RenderTexture.active = vertexColorOutput;
vertexCamera.Render();
output.ReadPixels(new Rect(0, 0, 1, 1), 0, 0);
output.Apply();
newColors = output.GetPixel(0, 0);
}
___________ = newColors; //Why are newColors all “33 33 33 255”?
}