- Home /
Get texture pixels under a plane
Hi, given a plane on screen (it is actually a very thin box), I want to get all the pixels which it covers from a background texture (which covers the whole screen).
Note that the plane may be rotated in 3D (or the camera may be rotated), so just doing getPixels according to its scale won't be enough.
An expansive and rather inelegant solution that I thought of is acquiring the 4 corners of the plane in screen space from the camera. Then, getting all the pixels between these corners.
Answer by Joyrider · Aug 14, 2013 at 08:30 AM
My guess is you want to use a screenspace shader. But you'd need Unity Pro for that.
In the Unity surface shader examples here, scroll down to "Detail Texture in Screen Space"; and you should find what you are looking for.
That will help me using the texture on the plane visually. But I actually need the pixel data to perform analysis on (that is, I need the data itself to work on).
Your answer
![](https://koobas.hobune.stream/wayback/20220613112158im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can I make my game's art pixel perfect with a 2:1 pixel ratio? 0 Answers
Red flash for each network player when he gets hit 1 Answer
full screen wide GUI.Box 3 Answers
How can I turn off texture filtering on procedurally generated textures? 1 Answer
Get the color value of a pixel in a texture or send data array 0 Answers