Getting Started with CG 1: Input output and semantics

Source: Internet
Author: User

http://blog.csdn.net/aa4790139/article/details/50963097


Knowledge Points: 1. Input and output of vertex and fragment programs 2. Common meanings 3. Write a simple shader
Input: In output with: out even if input is output: inout
CG Syntax: Cgprogram start to identify ENDCG end identity

Objpos: Semantic Semantic keywords must be made up of all uppercase letters (objpos:position semantics: Objpos represents a position vector) and semantics represent only a running environment inout: Indicates that the input can be returned directly as output (vertex color output col as the input of the fragment program, matching by type, not by name )
Semantic type: POSITION, NORMAL, Binormal, Blendindices, Blendweight, TANGENT, PSIZE, TEXCOORD0 ~ TEXCOORD7
There are two ways to use the output of a vertex: the first type: return col out vertex color output
The second type: Define the structure and then output the structure body

the benefits of defining the structure are: clear, reduce the out,in, if as the output structure, then the inside of the elements are all output, if it is entered as a parameter, then your elements are all input
Tips: Properties under the _maincolor in the inspector color value can not see, also can not be adjusted.
Click on the red box to make it appear

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.