unity shader能支持渲染么

2024-11-19 18:43:51
推荐回答(1个)
回答1:

1、通过Assets->Create->Shader来创建一个默认的Shader,并取名键历“MyShader”。

Unity3D教程:3D角色的渲染
2、将MyShader打开即可看见Unity默认的Shader代码首乱

01 Shader "Custom/稿芹搜MyShader" {

02 Properties {

03 _MainTex ("Base (RGB)", 2D) = "white" {}

04 }

05 SubShader {

06 Tags { "RenderType"="Opaque" }

07 LOD 200

08 CGPROGRAM

09 #pragma surface surf Lambert

10 sampler2D _MainTex;

11 struct Input {

12 float2 uv_MainTex;

13 };

14 void surf (Input IN, inout SurfaceOutput o) {

15 half4 c = tex2D (_MainTex, IN.uv_MainTex);

16 o.Albedo = c.rgb;

17 o.Alpha = c.a;

18 }

19 ENDCG

20 }

21 FallBack "Diffuse"