More options with Vertex options in the upcoming quest shader
~Menty~
I like the idea of using Vertex colors for some parts but as of now even with the new upcoming quest shader the options for vertex is quite lacking, and i would like to see that be expanded on. I wrote a code that make simple vertex data look really good, it is a very lightweight code too.
I couldnt upload the code so ill post here in raw format.
Shader "Wicked/VertexColor_Lit"
{
Properties
{
_Brightness ("Brightness", Range(0, 2)) = 1
_ColorTint ("Color Tint", Color) = (1,1,1,1)
_MinBrightness ("Minimum Brightness", Range(0, 1)) = 0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
Pass
{
Tags { "LightMode"="ForwardBase" }
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fwdbase
#include "UnityCG.cginc"
#include "Lighting.cginc"
float _Brightness;
float4 _ColorTint;
float _MinBrightness;
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 color : COLOR;
};
struct v2f
{
float4 vertex : SV_POSITION;
float3 worldNormal : TEXCOORD0;
float3 worldPos : TEXCOORD1;
float3 vertColor : COLOR0;
};
v2f vert(appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.worldNormal = UnityObjectToWorldNormal(v.normal);
o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
o.vertColor = GammaToLinearSpace(v.color.rgb) * _ColorTint.rgb;
return o;
}
fixed4 frag(v2f i) : SV_Target
{
float3 N = normalize(i.worldNormal);
float3 L = normalize(_WorldSpaceLightPos0.xyz);
float NdotL = max(0, dot(N, L));
float3 diffuse = NdotL * _LightColor0.rgb;
float3 ambient = ShadeSH9(float4(N, 1.0));
float3 lighting = diffuse + ambient;
lighting = lighting * (1 - _MinBrightness) + _MinBrightness;
float3 finalColor = i.vertColor
lighting
_Brightness;return fixed4(finalColor, 1.0);
}
ENDCG
}
}
FallBack "VertexLit"
}
Log In