I wrote a Mask shader and used it on a plane to create a circular RenderTexture(miniMap) now I want to write the whole texture from the Mesh to a "Texture2D" (or raw Texture). The
Renderer.material.mainTexture only gives the main texture, not the shader'ed(masked) texture itself
asked Sep 14 '11 at 06:59 AM
Are you trying to use the resultant texture with UnityGUI? While there is no way of doing exactly what you are asking for here (as far as I know), there are a few functions you can use that can achieve the same goal through a different method. For example, if you want to draw the texture to a rectangle on the screen, try Graphics.DrawTexture to draw a "shader'ed" texture directly to the screen for one frame. Or, if that doesn't work for you, you can manually move the masked mesh to a point just in front of the camera, and make it a child of the camera so that it stays in the same place at all times. If it clips through terrain or other objects at times, try making a new camera which only shows one layer- and then put the minimap object on that layer! This way you can put the minimap wherever you like on the screen, and if you set the clear flags on the second camera to CameraClearFlags.Nothing and then make sure it always renders after the main camera, then your minimap will display on top of everything else.
answered Sep 14 '11 at 07:11 AM