Shader Yamashita (16) Coordinate space and transformation matrix

Source: Internet
Author: User

Model space, also known as Object space, or local space, refers to a coordinate system with the origin of the model origin.

World space, also known as global space, is the coordinate system with the origin of the world origin, and the world coordinates are the absolute coordinates of the unity3d.

The view space is also known as the camera space, which is the coordinate system of the camera as the origin. (This is the only right-handed coordinate system in each coordinate space)

Clip space is also known as the homogeneous clip space, which crops the rendered elements in the observation space, preserves elements that are completely inside the space, rejects elements that are completely outside the space, and trims the elements inside the space, The range of this space is determined by the camera's cone of view. The projection matrix is used to convert the vertices to the clipping space to determine if the elements are in the clipping space.

Screen space represents a two-dimensional space that is projected from the clipping space.

From the model space to the world space is called the model transformation, from the world space to the observation space is called the observation transformation, from the observation space to the clipping space is called the projection transformation, from the clipping space to the screen space is called the projection mapping.


Related Mathematics Knowledge Yao 㙓 Mathematics Lesson (four) spatial transformation.


Unity built-in transformation matrix:

Unity_matrix_mvp Model (M) observation (V) projection (P) matrix, from model space to clipping space
Unity_matrix_mv Model (M) observation (V) matrix, from model space to observation space
Unity_matrix_v
Observing (V) matrices, from world space to observation space
Unity_matrix_p
Projection (P) matrix, from observation space to clipping space
Unity_matrix_vp
Observe (V) the projection (P) matrix, from world space to clipping space
Unity_matrix_t_mv
Transpose matrix of UNITY_MATRIX_MV
Unity_matrix_it_mv
UNITY_MATRIX_MV inverse matrix for converting normals from model space to observation space
_object2world Model matrix, from model space to world space
_world2object The inverse matrix of _object2world, from world space to model space


untiy Camera and Screen parameters:

_worldspacecamerapos (FLOAT3) World coordinates of the camera
_projectionparams (FLOAT4) Projection parameters
x=±1.0 (-1.0 means rendering using the flip projection matrix)
Y=near near clipping plane and camera distance
Z=far far cutting plane and camera distance
W=1.0+1.0/far
_screenparams (FLOAT4) Screen parameters
X=width the pixel width of the render target
Y=height The pixel height of the render target
Z=1.0+1.0/width
W=1.0+1.0/height
_zbufferparams (FLOAT4) Linearization z (depth) buffer parameters
X=1-far/near
Y=far/near
Z=x/far
W=y/far
Unity_orthoparams (FLOAT4) Orthogonal projection camera parameters
X=width
Y=height
Z Not used
w=1.0 (orthographic projection camera) or 0.0 (perspective camera)
Unity_cameraprojection (float4x4) Camera projection matrix
Unity_camerainvprojection (float4x4) Inverse matrix of Unity_cameraprojection
Unity_cameraworldclipplanes (Float4[6]) Camera 6 clipping plane equation in world space.
Order: Left, right, down, up, near, far

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.