Unity Shader Learning Notes (1) Shader infrastructure and properties panel

Source: Internet
Author: User

The first is the shader infrastructure:

1Shader"Custom/example2 {3 properties//Variable Properties panel4     {5     }6 Subshader7     {8Tags {"Rendertype"="Opaque"}//Setting rendering status and labels9Lod -Ten Pass One {//Start CG code snippet A Cgprogram -             #pragmaVertex vert//vertex shader -             #pragmaFragment frag//Fragment Shader the#include"Unitycg.cginc" -  -             structAppData; -             structv2f;  + v2f Vert (AppData v) {} - fixed4 Frag (v2f i): sv_target{} + ENDCG A         } at     } -}

Then the properties panel is defined:

Actual code:

1 Properties2     {3_mycolor ("MyColor", Color) = (1,1,1,1)        4_myvector ("Myvector", Vector) = (1,2,3,4)5_myrange ("MyRange", Range (1, -))=16_myfloat ("myfloat",float)=0   7_my2d ("my2d", 2D) =" White"{}//white refers to the default output color without a picture8_my3d ("My3d", 3D) =" White"{}9_mycube ("Mycube", Cube) ="_skybox" { }Ten}

Panel effect:

Unity Shader Learning Notes (1) Shader infrastructure and properties panel

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.