CG Language Sv_position vs POSITION

Source: Internet
Author: User

The semantic binding (semantics binding) was inadvertently exposed to sv_position in Unity3d's Shader lab development
Previously learned CG language vertex shader or fragment shader input and output semantic bindings are used position.
Doubts must be inquisitive to be relieved, so check the n many posts, to find the approximate clues.

The answer is that the variable sv_ prefixes represents system value, which is used in the semantic bindings after DX10 to represent special meanings, and is not different from position usage. The only difference is that once the sv_postion is used as the output semantics of the vertex shader, the final vertex position is fixed (no tensellate, no further changes to its space position. ), directly into the raster processing, if as the input semantics of the fragment shader and position is the same, representing the location of each pixel on the screen (this statement is not accurate, the fact is fragment in the location of the view space, But the intuitive feeling is as described in parentheses before the general)
Finally, the respondents said that the predefined semantics of sv_ were not introduced before the DX10 version, and position was used as input parameters for vertex shader input, output, fragment shader. However, after DX10 it is recommended to use Sv_position as the output of vertex shader and fragment shader input, note vertex shader input or use position. Remember. But after DX10 code is still compatible with position as the whole expression, it is estimated that the compiler will automatically judge and replace it. Okay, Sv_position's doubts are untied.

If you are an avid teenager, please follow my blog: Please call me: P

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.