"Unity_api Analysis" chapter II (bottom) Camera class instance method

Source: Internet
Author: User
Tags instance method

Rendertocubemap method: Generate CubeMap static map (Pro version available)

1.public bool Rendertocubemap (Cubemap Cubemap), parameter Cubemap static map 2.public bool Rendertocubemap (Rendertectur Cubemap) Where the parameter Cubemap is rendertexture static map 3.public bool Rendertocubemap (Cubemap Cubemap, int facemask), where the parameter Cubemap is Cubemap static map, Facemaske is the number of reflective polygons, the default value is 63.4.public bool Rendertocubemap (rendertexture cubemap, int facemaske); Where the parameter cubemap is rendertexture static map, facemask is the number of reflective polygons, the default value is 63. Function describes the effect of this method using the camera to generate a cubemap static map, when the Facemaske value is 63 o'clock, indicating that the cubemap of the upper and lower left and right front and back 6 faces all reflection, in this case the system calculates the consumption is also the largest, the value is a binary calculation of the parameters, The default value is 63, or 111111, which means that 6 faces are fully open, and if you do not need full reflection, you need to modify the value of facemask.  renderwithshader method: Render public void Renderwithshader (Shader Shader, String replacementtag) with other Shader; The parameter is the tag label of the shader and shader to be used. Function Description The function of this method is that the specified shader can be used instead of the SHADR render frame of the current object. When the Replacementtag is empty, the shader of all objects in the mouth are replaced.  scrreenpointtoray method: Myopic mouth to the screen of the Ray Sceenpointtoray (Vector3 position), the parameter is the screen position reference point. The function of this method is that it can transmit a ray of nearclip forward from the camera's myopic mouth to the position point on the screen. The reference point position uses the actual pixels to determine the location of the ray to the screen. When the X-axis component or y-axis component of the reference point position increases from 0 to the maximum, Ray moves from one side of the screen to the other. When Ray fails to collide with the object, the Hit.point return value is Vector3 (0,0,0). Z-axis of reference point positionThe measure value is not valid.  screentoviewportpoint method: Coordinate system conversion public Vector3 Screentoviewportpoint (Vector3 position), where parameter position is the screen reference point function description The function of this method is to implement the position coordinate system transformation from the screen coordinate system to the camera viewport. The X and Y components of the reference point position are the actual coordinate values of the screen, in pixels, and the z value is not valid.  screentoworldpoint method: The coordinate system transforms public Vector3 Screentoworldpoint (Vector3 position), where the parameter position is the screen reference point. The function of this method is to position the reference point from the screen coordinate system to the world coordinate system. This method is similar to the method Viewporttoworldpoint function. Only the value of each component in the reference point position of this method is the actual unit pixel value, not the scale value.  settargetbuffers method: Resets the camera to targettexture render 1.public void Settargetbuffers (Renderbuffer colorbuffer, Renderbuffer depth buffer) where the parameter colorbuffer is the color cache of the texture, depthbuffer the depth cache for the texture. 2.public void Settargetbuffers (renderbufeer[] colorbuffer,renderbuffer depth buffer), where the parameter colorbuffer is the color cache for the texture, Depthbuffer is the depth cache for textures. This overloaded method allows the camera's rendering to be paid to more than one colorbuffer at a time this method is used to assign the camera's rendering to Rendertexture Colorbuffer and Depthbuffer.  viewporttoworldpoint method: Coordinate point coordinate system conversion public Vector3 Viewporttoworldpoint (Vector3 positrion); function description This method is implemented from the camera viewport coordinate point to the world coordinate point of the conversion, and the method worldtoviewportpoint the function of the opposite. The return value size of this method is subject to the current camera's position in the world coordinate system camera's FieldofviewValues and the position of reference points. The valid range of the X and Y components of the reference point position is [0,0,1,0], which is the proportional value, while the Z-value is the actual unit value, non-proportional value. This method is temporarily unavailable, and the algorithm is later researched.  worldtoscreenpoint method: Coordinate point coordinate system conversion public Vector3 Worldtoscreenpoint (Vector3 position) parameter is the coordinate point function description in the world coordinate system to be converted This method is used to convert from world coordinate point to screen coordinate point, that is, coordinate point position projected to the screen coordinate value. The X and Y components of the return value are calculated as a planar coordinate system in the lower-left corner (0,0) of the screen.  worldtoviewportpoint method: Coordinate point coordinate system transformation Public Vector3 Worldtoviewportpoint (Vector3 position), where the parameter is the coordinate point in the world coordinate system to be converted. Function Description The function of this method is to convert the three-dimensional coordinate point position from the world coordinate system to the screen's unit coordinate system total, that is, the world coordinate point position the X, y component of the coordinate point that is projected onto the screen to the size of the screen height. This method is similar to the method Worldtoscreenpoint function, where the x and Y components of the return value are scale values, with the total width and total height of the screen being the maximum of the X and Y components, respectively.
Comments on the relationship between camera viewport, aspect, Pixelrect, and Rect. The 1.Camera viewport is used to record what the current camera can see in the scene, and its size and position can be changed. While the screen viewport refers to the current hardware screen, for a fixed hardware (for example, the phone), its screen viewport size (i.e. resolution) is fixed. The contents of the camera viewport are not necessarily fully visible on the screen, the screen may show only a portion of the content of the mouth, or the contents of the viewport can be indented. It can be simply understood that the camera viewport is a two-dimensional picture, and the screen is used to display the picture, the picture may be cut, may also be compressed. The way the content of the camera viewport is realistic to the screen is determined by many factors. The aspect option in the 2.Unity 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. The full screen mode simulates the hardware screen resolution with the size of the current game screen, and the camera viewport is the default state of the current camera. In the fixed scale mode, the width and height ratio of the Camea viewport is changed, and its size is not fixed. In the fixed resolution mode, the maximum width and height of the viewport is fixed, and when the game viewport width and height is greater than the fixed resolution, it has a small display interval will maintain a fixed resolution size. 3. In the case of camera.aspect fixation, the actual content of the game view is the same regardless of which screen emulation method is selected. Different screen simulations will only shrink the actual content. Deciding what the screen viewport is showing is the value of the Camera.aspect and the camera's transform, as for how the screen should display the contents of the camera viewport, which is what the hardware display is going to handle. The 4.PixelRect and RECT functions are similar in that they determine how the hardware display displays the content provided by the camera viewport. The difference is that Pixelrect displays the content in real pixels, and rect displays the display in a flat form.

"Unity_api Analysis" chapter II (bottom) Camera class instance method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.