Removed hard zone boundaries Fixed stuff that broke because of hard zone boundary assumption (stardust placement, vertical fog) Added a skybox! Removed density-based albedo boost (_TintExponent) to improve perceptual uniformity at different step sizes, reconfigured shader to achieve / surpass previous looks and performance Cell Brush has a material editor now to enable variant selection Enabled Caching Shader Preprocessor Moved raymarching loop into CloudShader Get environment settings from game manager to enable configuration / variation Introduced slope-based nebulae damping and volumetric flow Hid optional volumetric features behind preprocessor branches Created shader variants selected by global keywords for all shaders depending on volumetrics Environment settings used to configure shader variant selection Moved dynamic lighting settings to own subclass Dynamically adjust gravity map isoline contour depth range according to zone contents
80 lines
No EOL
2 KiB
Text
80 lines
No EOL
2 KiB
Text
Shader "Aetheria/Asteroid"
|
|
{
|
|
Properties
|
|
{
|
|
[NoScaleOffset] _MainTex ("Texture", 2D) = "white" {}
|
|
}
|
|
|
|
CGINCLUDE
|
|
|
|
#pragma multi_compile_instancing
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#include "UnityCG.cginc" // for UnityObjectToWorldNormal
|
|
#include_with_pragmas "Assets/Shaders/Volumetric.cginc"
|
|
uniform float _AsteroidVerticalOffset;
|
|
|
|
struct v2f
|
|
{
|
|
float2 uv : TEXCOORD0;
|
|
half3 ambient : COLOR0;
|
|
float4 vertex : SV_POSITION;
|
|
};
|
|
|
|
v2f vert (appdata_base v)
|
|
{
|
|
v2f o;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
float3 worldOrigin = mul(unity_ObjectToWorld, float4(0, 0, 0, 1.0)).xyz;
|
|
float3 worldPos = mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1.0)).xyz;
|
|
const float2 uv = getUV(worldOrigin.xz);
|
|
const float surfaceDisp = tex2Dlod(_NebulaSurfaceHeight, half4(uv, 0, 0)).r;
|
|
worldPos.y += _AsteroidVerticalOffset - surfaceDisp;
|
|
o.vertex = mul(UNITY_MATRIX_VP, float4(worldPos, 1.0));
|
|
o.uv = v.texcoord;
|
|
// get vertex normal in world space
|
|
half3 worldNormal = UnityObjectToWorldNormal(v.normal);
|
|
|
|
o.ambient = VolumeSampleColorSimple(worldPos, worldNormal).rgb * 10;
|
|
return o;
|
|
}
|
|
|
|
sampler2D _MainTex;
|
|
|
|
fixed4 frag (v2f i) : SV_Target
|
|
{
|
|
// sample texture
|
|
fixed4 col = tex2D(_MainTex, i.uv);
|
|
// multiply by lighting
|
|
col.rgb *= i.ambient;
|
|
return col;
|
|
}
|
|
|
|
float4 frag_shadow(v2f i) : COLOR
|
|
{
|
|
SHADOW_CASTER_FRAGMENT(i)
|
|
}
|
|
|
|
ENDCG
|
|
|
|
SubShader
|
|
{
|
|
Pass
|
|
{
|
|
Tags {"LightMode"="ForwardBase"}
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
ENDCG
|
|
}
|
|
Pass
|
|
{
|
|
Name "ShadowCaster"
|
|
Tags { "LightMode" = "ShadowCaster" }
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag_shadow
|
|
ENDCG
|
|
}
|
|
}
|
|
} |