渲染需要:
- 首先是需要渲染的模型/粒子。
- 然后,unity材质球元素。
- 最后需要unityshader。
效果图:
unityshader和shader的概念是不一样的,相当于简单封装了一下,实际上是CG语言。 unlit shader-顶点片元shader:
Shader "Unlit/001"
{
Properties
{
_Int("Int",Int)=2
_Float("Float",float)=1.5
_Range("Range",range(0.0,20.))=1.0
_Color("Color",Color)=(0,0,0,0)
_Vector("Vector",Vector)=(1,4,3,8)
_MainTex("Texture":,2D) = "white"{}
_Cube("Cube",cube)="White"{}
_3D("3D",3D)="black"{}
}
SubShader
{
Tags
{
"Queue"="Transparent"
"RenderType"="Opaque"
"DisableBatching"="True"
"ForceNoShadowCasting"="True"
"IgnoreProjector"="True"
"CanUseSpriteAltas"="False"
"PreviewType"="Plane"
}
Cull off/back/front
ZTest Always/Less Greater/LEqual/GEqual/Equal/NotEqual
Zwrite off/on
Blend SrcFactor DstFactor
Lod 100
Pass
{
Name "Default"
Tags{
"LightMode"="ForwardBase"
"RequireOptions"="SoftVegetation"
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex:POSITION;
float2 uv:TEXCOORD0;
};
struct v2f
{
float uv:TEXCOORD0;
UNITY_FOG_COORDS(1)
float vertex:SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
v2f vert (appdata v)
{
v2f o;
o.vertex=UnityObjectToChilpPos(v.vertex);
o.uv=TRANSFORM_TEX(v.uv,_MainTex);
}
}
}
Fallback off
}
效果图:
|