zoukankan      html  css  js  c++  java
  • Shaderlab -chapter7

    半勃兰特光照模型
    本质 结果范围 -1~1变为0~1。

    
    Shader "Unlit/First"
    { 
    	//1 属性
    	Properties {
    		//_MainTex("MainTex",2D)= "White" {};
    		_Color ("color",Color) = (1,1,1,1)
    	}
    	//2 子Shader
    	SubShader{
    		//3 Pass
    		Pass{
    			//4设置渲染状态和标签
    			Tags{ "Queue" = "Transparent" "LightMode"="ForwardBase"}
    			//5 开始CG代码片段
    			CGPROGRAM
    			//1 该代码片段的编译指令
    			#pragma vertex vert
    			#pragma fragment frag 
    			//2 include光照变量
    			#include "Lighting.cginc"
    			//sampler2D _MainTex;
    
    			//3 声明变量和结构体
    			float4 _Color;
    			struct a2v{
    				float4 vert: POSITION;
    				fixed3 normal:NORMAL;
    			};
    			struct v2f{
    				float4 pos:SV_POSITION;// SV-system value表示是光栅化后的坐标
    			};
    
    			//4函数实现
    			//顶点着色器
    			v2f vert(a2v v){
    				v2f o;
    				o.pos = mul(UNITY_MATRIX_MVP, v.vert);
    				return o;	
    			}
    
    			//片元着色器
    			fixed4 frag(v2f i):SV_TARGET0 // SV-system value表示是光栅化后的..
    			{
    				return fixed4(_Color.rgb,1);
    			}
    	
    			ENDCG
    		}
    	}
    	//6 备用
    	FallBack "DIFFUSE"
    }
    
  • 相关阅读:
    JavaScript String常用方法和属性
    JavaScript null 和 undefined
    document.write()
    MyBatis中的@MapKey注解
    Zookeeper实现分布式锁
    zookeeper相关
    二阶段提交和三阶段提交
    代理模式
    模板方法模式
    策略模式
  • 原文地址:https://www.cnblogs.com/Jaysonhome/p/12952377.html
Copyright © 2011-2022 走看看