rendertocubemap--Generate cubemap static map
renderwithshader--rendering with other shader
Renders a frame in place of the shader of the current object using the specified shader. Replaces the shader of all objects in the viewport when the Replacementtag is empty
Setreplacementshader is similar to this method, but does not render only one frame
Screenpointtoray
Myopic mouth to the screen of the Rays. The reference point position the actual pixel value to determine where ray is to the screen. Ray moves from one side of the screen to the other when the x-axis component or y-axis component of the reference point position increases from 0 to the maximum value
Using unityengine;using system.collections;public class screenpointtoray_ts:monobehaviour{ ray Ray; Raycasthit hit; Vector3 v3 = new Vector3 (screen.width/2.0f, screen.height/2.0f, 0.0f); Vector3 hitpoint = Vector3.zero; void Update () { //ray is scanned from left to right along the x-axis of the screen v3.x = v3.x >= screen.width? 0.0f:v3.x + 1.0f; Generate ray ray = camera. Screenpointtoray (v3); if (Physics.raycast (Ray, out hit, 100.0f)) { //Draw line, visible in scene attempt debug.drawline (Ray.origin, Hit.point, Color.green); The output Ray detects the name of the object Debug.Log ("É??? Ì?2aμ?μ??? Ì??? 3?£o "+ Hit.transform.name);}}}
screentoviewportpoint--implement coordinate points position convert from a screen coordinate system to a camera viewport in units of pixels
screentoworldpoint--Convert the reference point position from the screen coordinate system to the world coordinate system, the actual units
settargetbuffers--resetting the camera to targettexture rendering
viewportpointtoray--myopic mouth to screen Ray
viewporttoworldpoint--transform from camera viewport coordinate point to world coordinate point
The return value size of this method is affected by the Fieldofview value of the camera and the position of the reference point in the current camera's position in the world coordinate system.
Worldtoscreenpoint
From the world coordinate point to the screen coordinate point conversion, that is, the coordinate point position projected to the screen coordinate values, the return value of the X and Y components are in the lower left corner of the screen (0,0) point, to the Y axis upward, to the right x axis to calculate the
Using unityengine;using System.collections;public class worldtoscreenpoint_ts:monobehaviour{public Transform CB , SP; public texture2d T2; Vector3 v3 = Vector3.zero; float SG; void Start () { //record screen height sg = screen.height; } void Update () { //SP Rotates the SP around the y-axis of the CB . Rotatearound (Cb.position, Cb.up, 30.0f * time.deltatime); Gets the coordinate point of the SP on the screen v3 = camera. Worldtoscreenpoint (sp.position); } void Ongui () { //Draw texture GUI. Drawtexture (New Rect (0.0f, SG-V3.Y, v3.x, SG), T2);} }
Worldtoviewportpoint
The three-dimensional coordinate point position from the world coordinate system to the unit coordinate system of the screen, that is, the world coordinate point position the X, y component of the coordinate point that is projected onto the screen as a percentage of the screen height.
The camera viewport is used to record what the current camera can see in the scene, its size and position can be changed
The screen viewport refers to the current hardware screen, and for a fixed hardware (such as a phone), its screen viewport size (resolution) is fixed
The contents of the camera viewport are not necessarily fully visible on the screen, and the screen may show only a portion of its contents
The aspect option of the game panel is used to emulate the hardware screen, and can be divided into 3 categories: full screen, fixed scale display and fixed resolution display
Unity API Parsing (2)--camera class methods