Hey guys. This is driving me crazy, I’m searching for solution for days, but nothing seems to answer my problem. Here is the deal. I need to create aura around low poly planet. So I was looking for shaders to add outline of some kind, but this won’t work since with flat shading, normals break the effect.
So basically I need to fake the effect by getting the shape of rendered object in solid color, apply large blur and then maybe in another pass place image of the standard render over it. I don’t need any atmosphere-like scattering, just to make it look like the color from the planet bleeds into the space somehow.
I attach picture of what I’m looking for. Can someone maybe guide me on which way to look to achieve this? (Mind, I’m complete shader noob.)
You don’t need to do that at all. All you need to do is have the same model at a larger size, and interpolate the alpha based on the fresnel shading technique. The following shader will do all of this, including the size:
Shader "Custom/Atmosphere" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_Size ("Atmosphere Size Multiplier", Range(0,16)) = 4
_Rim ("Fade Power", Range(0,8)) = 4
}
SubShader {
Tags { "RenderType"="Transparent" }
LOD 200
Cull Front
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Lambert fullforwardshadows alpha:fade
#pragma vertex vert
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
struct Input {
float3 viewDir;
};
half _Size;
half _Rim;
fixed4 _Color;
void vert (inout appdata_full v) {
v.vertex.xyz += v.vertex.xyz * _Size / 10;
v.normal *= -1;
}
void surf (Input IN, inout SurfaceOutput o) {
half rim = saturate (dot (normalize (IN.viewDir), normalize (o.Normal)));
// Albedo comes from a texture tinted by color
fixed4 c = _Color;
o.Emission = c.rgb;
o.Alpha = lerp (0, 1, pow (rim, _Rim));
}
ENDCG
}
FallBack "Diffuse"
}